code
stringlengths
17
296k
docstring
stringlengths
30
30.3k
func_name
stringlengths
1
89
language
stringclasses
1 value
repo
stringlengths
7
63
path
stringlengths
7
153
url
stringlengths
51
209
license
stringclasses
4 values
protected function isWorseStatus($newStatus, $currentStatus) { $levels = [ self::STATUS_UNKNOWN => -1, self::STATUS_OK => 0, self::STATUS_INFO => 2, self::STATUS_WARN => 5, self::STATUS_ERROR => 10, self::STATUS_FATAL => 20, ]; return ($currentStatus === null || $levels[$newStatus] > $levels[$currentStatus]); }
Checks if new status is worse than current status @param string $newStatus @param string $currentStatus @return bool true if newStatus is worse than old status.
isWorseStatus
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Result.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Result.php
Apache-2.0
protected function loadSessionHandler($sessionHandler, $params) { if ($sessionHandler instanceof HandlerInterface) { $newSessionHandler = $sessionHandler; } else { $newSessionHandler = HandlerFactory::createHandler($params); } return $newSessionHandler; }
Load the session handler Either load the provided session handler or create one depending on incoming parameters. @param HandlerInterface|null $sessionHandler @param Params\SessionHandlerParams|null $params @return HandlerInterface
loadSessionHandler
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Base.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Base.php
Apache-2.0
protected function loadRequestCreator($requestCreator, $params, $libIdentifier, $originatorOffice, $mesVer) { if ($requestCreator instanceof RequestCreatorInterface) { $newRequestCreator = $requestCreator; } else { $params->originatorOfficeId = $originatorOffice; $params->messagesAndVersions = $mesVer; $newRequestCreator = RequestCreatorFactory::createRequestCreator( $params, $libIdentifier ); } return $newRequestCreator; }
Load a request creator A request creator is responsible for generating the correct request to send. @param RequestCreatorInterface|null $requestCreator @param Params\RequestCreatorParams $params @param string $libIdentifier Library identifier & version string (for Received From) @param string $originatorOffice The Office we are signed in with. @param array $mesVer Messages & Versions array of active messages in the WSDL @return RequestCreatorInterface @throws \RuntimeException
loadRequestCreator
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Base.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Base.php
Apache-2.0
public function __doRequest($request, $location, $action, $version, $oneWay = null) { if (!extension_loaded('xsl')) { throw new Exception('PHP XSL extension is not enabled.'); } $newRequest = $this->transformIncomingRequest($request); return parent::__doRequest($newRequest, $location, $action, $version, $oneWay); }
__doRequest override of SoapClient @param string $request The XML SOAP request. @param string $location The URL to request. @param string $action The SOAP action. @param int $version The SOAP version. @param int|null $oneWay @uses parent::__doRequest @return string The XML SOAP response. @throws Exception When PHP XSL extension is not enabled or WSDL file isn't readable.
__doRequest
php
amabnl/amadeus-ws-client
src/Amadeus/Client/SoapClient.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/SoapClient.php
Apache-2.0
public function __construct($params = []) { foreach ($params as $propName => $propValue) { if (property_exists($this, $propName)) { $this->$propName = $propValue; //TODO support for objects that must be instantiated??? } } }
Construct Request Options object with initialization array @param array $params Initialization parameters
__construct
php
amabnl/amadeus-ws-client
src/Amadeus/Client/LoadParamsFromArray.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/LoadParamsFromArray.php
Apache-2.0
protected function loadFromArray(array $params) { if (isset($params['returnXml']) && is_bool($params['returnXml'])) { $this->returnXml = $params['returnXml']; } $this->loadRequestCreator($params); $this->loadSessionHandler($params); $this->loadResponseHandler($params); $this->loadAuthParams($params); $this->loadSessionHandlerParams($params); $this->loadRequestCreatorParams($params); }
Load parameters from an associative array @param array $params @return void
loadFromArray
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Params.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Params.php
Apache-2.0
public function __construct($params = []) { foreach ($params as $propName => $propValue) { if (property_exists($this, $propName)) { $this->$propName = $propValue; } } }
Construct Queue with initialization array @param array $params Initialization parameters
__construct
php
amabnl/amadeus-ws-client
src/Amadeus/Client/RequestOptions/Queue.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/RequestOptions/Queue.php
Apache-2.0
public function __construct(AuthParams $authParams = null) { if ($authParams instanceof AuthParams) { $this->loadFromAuthParams($authParams); } parent::__construct([]); }
SecurityAuthenticateOptions constructor. @param AuthParams|null $authParams
__construct
php
amabnl/amadeus-ws-client
src/Amadeus/Client/RequestOptions/SecurityAuthenticateOptions.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/RequestOptions/SecurityAuthenticateOptions.php
Apache-2.0
protected function loadFromAuthParams(AuthParams $authParams) { $this->officeId = $authParams->officeId; $this->dutyCode = $authParams->dutyCode; $this->organizationId = $authParams->organizationId; $this->originatorTypeCode = $authParams->originatorTypeCode; $this->userId = $authParams->userId; $this->passwordLength = $authParams->passwordLength; $this->passwordData = $authParams->passwordData; }
Load security authenticate options from auth params @param AuthParams $authParams
loadFromAuthParams
php
amabnl/amadeus-ws-client
src/Amadeus/Client/RequestOptions/SecurityAuthenticateOptions.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/RequestOptions/SecurityAuthenticateOptions.php
Apache-2.0
public function analyzeResponse($sendResult, $messageName) { if (!empty($sendResult->exception)) { return $this->makeResultForException($sendResult); } $handler = $this->findHandlerForMessage($messageName); if ($handler instanceof MessageResponseHandler) { return $handler->analyze($sendResult); } else { return new Result($sendResult, Result::STATUS_UNKNOWN); } }
Analyze the response from the server and throw an exception when an error has been detected. @param SendResult $sendResult The Send Result from the Session Handler @param string $messageName The message that was called @throws Exception @throws \RuntimeException @return Result
analyzeResponse
php
amabnl/amadeus-ws-client
src/Amadeus/Client/ResponseHandler/Base.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/ResponseHandler/Base.php
Apache-2.0
private function findHandlerForMessage($messageName) { $handler = null; if (array_key_exists($messageName, $this->responseHandlers) && $this->responseHandlers[$messageName] instanceof MessageResponseHandler ) { $handler = $this->responseHandlers[$messageName]; } else { $section = substr($messageName, 0, strpos($messageName, '_')); $message = substr($messageName, strpos($messageName, '_') + 1); $handlerClass = __NAMESPACE__.'\\'.$section.'\\Handler'.$message; if (class_exists($handlerClass)) { /** @var MessageResponseHandler $handler */ $handler = new $handlerClass(); $this->responseHandlers[$messageName] = $handler; } } return $handler; }
Find or create the correct handler object for a given message @param string $messageName @return MessageResponseHandler|null
findHandlerForMessage
php
amabnl/amadeus-ws-client
src/Amadeus/Client/ResponseHandler/Base.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/ResponseHandler/Base.php
Apache-2.0
protected function analyzeWithErrCodeCategoryMsgQuery(SendResult $response, $qErr, $qCat, $qMsg, $errLevel = null) { $analyzeResponse = new Result($response); $domXpath = $this->makeDomXpath($response->responseXml); $errorCodeNodeList = $domXpath->query($qErr); if ($errorCodeNodeList->length > 0) { $analyzeResponse->status = Result::STATUS_ERROR; $errorCatNode = $domXpath->query($qCat)->item(0); if ($errorCatNode instanceof \DOMNode) { $analyzeResponse->status = $this->makeStatusFromErrorQualifier($errorCatNode->nodeValue); } $analyzeResponse->messages[] = new Result\NotOk( $errorCodeNodeList->item(0)->nodeValue, $this->makeMessageFromMessagesNodeList( $domXpath->query($qMsg) ), $errLevel ); } return $analyzeResponse; }
Analyze response by looking for error, category and message with the provided XPATH queries xpath queries must be prefixed with the namespace self::XMLNS_PREFIX @param SendResult $response @param string $qErr XPATH query for fetching error code (first node is used) @param string $qCat XPATH query for fetching error category (first node is used) @param string $qMsg XPATH query for fetching error messages (all nodes are used) @param string|null $errLevel Optional custom error level string. @return Result
analyzeWithErrCodeCategoryMsgQuery
php
amabnl/amadeus-ws-client
src/Amadeus/Client/ResponseHandler/StandardResponseHandler.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/ResponseHandler/StandardResponseHandler.php
Apache-2.0
protected function analyzeWithErrorCodeMsgQueryLevel(SendResult $response, $qErr, $qMsg, $qLvl, $lvlToText) { $analyzeResponse = new Result($response); $domXpath = $this->makeDomXpath($response->responseXml); $errorCodeNodeList = $domXpath->query($qErr); if ($errorCodeNodeList->length > 0) { $analyzeResponse->status = Result::STATUS_ERROR; $lvlNodeList = $domXpath->query($qLvl); $level = null; if ($lvlNodeList->length > 0) { if (array_key_exists($lvlNodeList->item(0)->nodeValue, $lvlToText)) { $level = $lvlToText[$lvlNodeList->item(0)->nodeValue]; } } $analyzeResponse->messages[] = new Result\NotOk( $errorCodeNodeList->item(0)->nodeValue, $this->makeMessageFromMessagesNodeList( $domXpath->query($qMsg) ), $level ); } return $analyzeResponse; }
Analyze response by looking for error, message and level with the provided XPATH queries Result status defaults to Result::STATUS_ERROR if any error is found. xpath queries must be prefixed with the namespace self::XMLNS_PREFIX @param SendResult $response @param string $qErr XPATH query for fetching error code (first node is used) @param string $qMsg XPATH query for fetching error messages (all nodes are used) @param string $qLvl XPATH query for fetching error level (first node is used) @param array $lvlToText Level-to-text translation @return Result
analyzeWithErrorCodeMsgQueryLevel
php
amabnl/amadeus-ws-client
src/Amadeus/Client/ResponseHandler/StandardResponseHandler.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/ResponseHandler/StandardResponseHandler.php
Apache-2.0
public function analyzeWithErrCodeAndMsgQueryFixedCat(SendResult $response, $qErr, $qMsg, $category) { $analyzeResponse = new Result($response); $domXpath = $this->makeDomXpath($response->responseXml); $errorCodeNodeList = $domXpath->query($qErr); $errorMsgNodeList = $domXpath->query($qMsg); if ($errorCodeNodeList->length > 0 || $errorMsgNodeList->length > 0) { $analyzeResponse->status = $category; $errorCode = ($errorCodeNodeList->length > 0) ? $errorCodeNodeList->item(0)->nodeValue : null; $analyzeResponse->messages[] = new Result\NotOk( $errorCode, $this->makeMessageFromMessagesNodeList($errorMsgNodeList) ); } return $analyzeResponse; }
Analyse with XPATH queries for error code and message, provide fixed category @param SendResult $response @param string $qErr XPATH query for fetching error code (first node is used) @param string $qMsg XPATH query for fetching error messages (all nodes are used) @param string $category Result::STATUS_* The fixed error category (status) @return Result
analyzeWithErrCodeAndMsgQueryFixedCat
php
amabnl/amadeus-ws-client
src/Amadeus/Client/ResponseHandler/StandardResponseHandler.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/ResponseHandler/StandardResponseHandler.php
Apache-2.0
protected function analyzeWithErrCodeCategoryMsgNodeName(SendResult $response, $nodeErr, $nodeCat, $nodeMsg) { $analyzeResponse = new Result($response); $domDoc = $this->loadDomDocument($response->responseXml); $errorCodeNode = $domDoc->getElementsByTagName($nodeErr)->item(0); if (!is_null($errorCodeNode)) { $errorCatNode = $domDoc->getElementsByTagName($nodeCat)->item(0); if ($errorCatNode instanceof \DOMNode) { $analyzeResponse->status = $this->makeStatusFromErrorQualifier($errorCatNode->nodeValue); } else { $analyzeResponse->status = Result::STATUS_ERROR; } $errorCode = $errorCodeNode->nodeValue; $errorTextNodeList = $domDoc->getElementsByTagName($nodeMsg); $analyzeResponse->messages[] = new Result\NotOk( $errorCode, $this->makeMessageFromMessagesNodeList($errorTextNodeList) ); } return $analyzeResponse; }
Analyze response by looking for error, category and message in nodes specified by name @param SendResult $response @param string $nodeErr Node name of the node containing the error code (first node is used) @param string $nodeCat Node name of the node containing the error category (first node is used) @param string $nodeMsg Node name of the node containing the error messages (all nodes are used) @return Result
analyzeWithErrCodeCategoryMsgNodeName
php
amabnl/amadeus-ws-client
src/Amadeus/Client/ResponseHandler/StandardResponseHandler.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/ResponseHandler/StandardResponseHandler.php
Apache-2.0
protected function makeDomXpath($response) { $domDoc = $this->loadDomDocument($response); $domXpath = new \DOMXPath($domDoc); $domXpath->registerNamespace( self::XMLNS_PREFIX, $domDoc->documentElement->lookupNamespaceUri(null) ); return $domXpath; }
Make a Xpath-queryable object for an XML string registers TNS namespace with prefix self::XMLNS_PREFIX @param string $response @return \DOMXPath @throws Exception when there's a problem loading the message
makeDomXpath
php
amabnl/amadeus-ws-client
src/Amadeus/Client/ResponseHandler/StandardResponseHandler.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/ResponseHandler/StandardResponseHandler.php
Apache-2.0
protected function makeStatusFromErrorQualifier($qualifier, $defaultStatus = Result::STATUS_ERROR) { $statusQualMapping = [ 'INF' => Result::STATUS_INFO, 'WEC' => Result::STATUS_WARN, 'WZZ' => Result::STATUS_WARN, //Mutually defined warning 'WA' => Result::STATUS_WARN, //Info line Warning - PNR_AddMultiElements 'W' => Result::STATUS_WARN, 'EC' => Result::STATUS_ERROR, 'ERR' => Result::STATUS_ERROR, //DocRefund_UpdateRefund 'ERC' => Result::STATUS_ERROR, //DocRefund_UpdateRefund 'X' => Result::STATUS_ERROR, '001' => Result::STATUS_ERROR, //Air_MultiAvailability 'O' => Result::STATUS_OK, 'STA' => Result::STATUS_OK, 'ZZZ' => Result::STATUS_UNKNOWN ]; if (array_key_exists($qualifier, $statusQualMapping)) { $status = $statusQualMapping[$qualifier]; } elseif (is_null($qualifier)) { $status = $defaultStatus; } else { $status = Result::STATUS_UNKNOWN; } return $status; }
Converts a status code found in an error message to the appropriate status level if no node found (= $qualifier is a null), $defaultStatus will be used @param string|null $qualifier @param string $defaultStatus the default status to fall back to if no qualifier is present @return string Result::STATUS_*
makeStatusFromErrorQualifier
php
amabnl/amadeus-ws-client
src/Amadeus/Client/ResponseHandler/StandardResponseHandler.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/ResponseHandler/StandardResponseHandler.php
Apache-2.0
protected function makeMessageFromMessagesNodeList($errorTextNodeList) { return implode( ' - ', array_map( function ($item) { return trim($item->nodeValue); }, iterator_to_array($errorTextNodeList) ) ); }
Convert a DomNodeList of nodes containing a (potentially partial) error message into a string. @param \DOMNodeList $errorTextNodeList @return string|null
makeMessageFromMessagesNodeList
php
amabnl/amadeus-ws-client
src/Amadeus/Client/ResponseHandler/StandardResponseHandler.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/ResponseHandler/StandardResponseHandler.php
Apache-2.0
protected function getErrorTextFromQueueErrorCode($errorCode) { $recognizedErrors = [ '1' => 'Invalid date', '360' => 'Invalid PNR file address', '723' => 'Invalid category', '727' => 'Invalid amount', '79A' => 'Invalid office identification', '79B' => 'Already working another queue', '79C' => 'Not allowed to access queues for specified office identification', '79D' => 'Queue identifier has not been assigned for specified office identification', '79E' => 'Attempting to perform a queue function when not associated with a queue', '79F' => 'Queue placement or add new queue item is not allowed for the specified office and queue', '911' => 'Unable to process - system error', '912' => 'Incomplete message - data missing in query', '913' => 'Item/data not found or data not existing in processing host', '914' => 'Invalid format/data - data does not match EDIFACT rules', '915' => 'No action - processing host cannot support function', '916' => 'EDIFACT version not supported', '917' => 'EDIFACT message size exceeded', '918' => 'Enter message in remarks', '919' => 'No PNR in AAA', '91A' => 'Inactive queue bank', '91B' => 'Nickname not found', '91C' => 'Invalid record locator', '91D' => 'Invalid format', '91F' => 'Invalid queue number', '920' => 'Queue/date range empty', '921' => 'Target not specified', '922' => 'Targetted queue has wrong queue type', '923' => 'Invalid time', '924' => 'Invalid date range', '925' => 'Queue number not specified', '926' => 'Queue category empty', '927' => 'No items exist', '928' => 'Queue category not assigned', '929' => 'No more items', '92A' => '>ueue category full' ]; $errorMessage = (array_key_exists($errorCode, $recognizedErrors)) ? $recognizedErrors[$errorCode] : ''; if ($errorMessage === '') { $errorMessage = "QUEUE ERROR '".$errorCode."' (Error message unavailable)"; } return $errorMessage; }
Returns the errortext from a Queue_*Reply errorcode This function is necessary because the core only responds with errorcode but does not send an errortext. The errorcodes for all Queue_*Reply messages are the same. @link https://webservices.amadeus.com/extranet/viewArea.do?id=10 @param string $errorCode @return string the errortext for this errorcode.
getErrorTextFromQueueErrorCode
php
amabnl/amadeus-ws-client
src/Amadeus/Client/ResponseHandler/Queue/HandlerList.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/ResponseHandler/Queue/HandlerList.php
Apache-2.0
public static function findMessage($code) { $message = null; if (array_key_exists($code, self::$errorList)) { $message = self::$errorList[$code]; } return $message; }
Find the error message for a given error code @param string $code @return string|null
findMessage
php
amabnl/amadeus-ws-client
src/Amadeus/Client/ResponseHandler/Air/HandlerRetrieveSeatMap.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/ResponseHandler/Air/HandlerRetrieveSeatMap.php
Apache-2.0
public static function decodeProcessingLevel($level) { $decoded = null; $map = [ 0 => 'system', 1 => 'application' ]; if (array_key_exists($level, $map)) { $decoded = $map[$level]; } return $decoded; }
Decode error processing level code @param int|string $level @return string|null
decodeProcessingLevel
php
amabnl/amadeus-ws-client
src/Amadeus/Client/ResponseHandler/Air/HandlerRetrieveSeatMap.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/ResponseHandler/Air/HandlerRetrieveSeatMap.php
Apache-2.0
public function analyze(SendResult $response) { return $this->analyzeSimpleResponseErrorCodeAndMessage($response); }
Analysing a PNR_TransferOwnershipReply @param SendResult $response @return Result
analyze
php
amabnl/amadeus-ws-client
src/Amadeus/Client/ResponseHandler/PNR/HandlerTransferOwnership.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/ResponseHandler/PNR/HandlerTransferOwnership.php
Apache-2.0
public function analyze(SendResult $response) { $analyzeResponse = new Result($response); $domXpath = $this->makeDomXpath($response->responseXml); $queryAllErrorCodes = "//m:generalErrorGroup//m:errorNumber/m:errorDetails/m:errorCode"; $queryAllErrorMsg = "//m:generalErrorGroup/m:genrealErrorText/m:freeText"; $errorCodeNodeList = $domXpath->query($queryAllErrorCodes); if ($errorCodeNodeList->length > 0) { $analyzeResponse->status = Result::STATUS_ERROR; $code = $errorCodeNodeList->item(0)->nodeValue; $errorTextNodeList = $domXpath->query($queryAllErrorMsg); $message = $this->makeMessageFromMessagesNodeList($errorTextNodeList); $analyzeResponse->messages[] = new Result\NotOk($code, trim($message)); } return $analyzeResponse; }
Analysing a PNR_DisplayHistoryReply @param SendResult $response @return Result
analyze
php
amabnl/amadeus-ws-client
src/Amadeus/Client/ResponseHandler/PNR/HandlerDisplayHistory.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/ResponseHandler/PNR/HandlerDisplayHistory.php
Apache-2.0
public function analyze(SendResult $response) { $analyzeResponse = new Result($response); $domXpath = $this->makeDomXpath($response->responseXml); $qPassErrors = "//m:passengerErrorInEnhancedData//m:errorDetails/m:errorCode"; $qPassErrorCat = "//m:passengerErrorInEnhancedData//m:errorDetails/m:errorCategory"; $qPassErrorMsg = "//m:passengerErrorInEnhancedData//m:freeText"; $errorCodeNodeList = $domXpath->query($qPassErrors); if ($errorCodeNodeList->length > 0) { $analyzeResponse->status = Result::STATUS_ERROR; $errorCatNode = $domXpath->query($qPassErrorCat)->item(0); if ($errorCatNode instanceof \DOMNode) { $analyzeResponse->status = $this->makeStatusFromErrorQualifier($errorCatNode->nodeValue); } $code = $errorCodeNodeList->item(0)->nodeValue; $errorTextNodeList = $domXpath->query($qPassErrorMsg); $message = $this->makeMessageFromMessagesNodeList($errorTextNodeList); $analyzeResponse->messages[] = new Result\NotOk($code, trim($message), 'passenger'); } if (empty($analyzeResponse->messages) && $analyzeResponse->status === Result::STATUS_OK) { $analyzeResponse = $this->analyzeSimpleResponseErrorCodeAndMessage($response); } return $analyzeResponse; }
Analysing a PNR_NameChangeReply @param SendResult $response @return Result
analyze
php
amabnl/amadeus-ws-client
src/Amadeus/Client/ResponseHandler/PNR/HandlerNameChange.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/ResponseHandler/PNR/HandlerNameChange.php
Apache-2.0
public function analyze(SendResult $response) { return $this->analyzeSimpleResponseErrorCodeAndMessage($response); }
Analyze Ticket_DisplayTSMFareElement response. @param SendResult $response @return Result
analyze
php
amabnl/amadeus-ws-client
src/Amadeus/Client/ResponseHandler/Ticket/HandlerDisplayTSMFareElement.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/ResponseHandler/Ticket/HandlerDisplayTSMFareElement.php
Apache-2.0
protected function getErrorTextFromQueueErrorCode($errorCode) { $recognizedErrors = [ '1' => 'Invalid date', '107' => 'Invalid Airline Designator/Vendor Supplier', '109' => 'Invalid Country Code', '111' => 'Invalid Agent\'s Code', '112' => 'Requestor Identification Required', '113' => 'Invalid Period of Operation', '114' => 'Invalid Flight Number', '115' => 'Invalid Arrival Date', '116' => 'Invalid Arrival Time', '118' => 'System Unable to Process', '12' => 'Invalid product details qualifier coded', '120' => 'Invalid Action Code', '129' => 'No PNR Match Found', '130' => 'Invalid Origin and Destination Pair', '134' => 'Advise Times Different from Booked', '135' => 'Advise Dates Different from Booked', '136' => 'Advise Class Different from Booked', '144' => 'Invalid Requestor Identification', '149' => 'Surname too Long', '151' => 'Surname Mandatory', '152' => 'Given Name/Title Mandatory', '153' => 'Name Mismatch', '154' => 'Message Function Invalid', '155' => 'Message Function Not Supported', '156' => 'Business Function Invalid', '157' => 'Business Function Not Supported', '159' => 'Phone Field Required', '18' => 'Invalid on-time performance indicator', '19' => 'Invalid type of call at port coded', '190' => 'Invalid Processing Indicator', '191' => 'Name Reference Required', '192' => 'Name Reference Inhibited', '193' => 'Segment Reference Required', '194' => 'Segment Reference Inhibited', '2' => 'Invalid time', '20' => 'Invalid government action coded', '21' => 'Invalid facility type coded', '22' => 'Invalid traffic restriction coded', '23' => 'Invalid traffic restriction type coded', '24' => 'Invalid traffic restriction qualifier coded', '244' => 'Not allowed on marketing flights', '245' => 'Please request on operating carrier', '25' => 'Invalid transport stage qualifier coded', '259' => 'Invalid Combination of Generic Codes', '260' => 'Invalid Frequent Traveler Number', '266' => 'Limited Recline Seat has been Reserved', '267' => 'Name in the Request Does Not Match Name in Reservation', '268' => 'Need Names, Passenger Name Information Required to Reserve Seats', '269' => 'Indicates that Additional Data for this Message Reference Number follows', '288' => 'Unable to Satisfy, Need Confirmed Flight Status', '289' => 'Unable to Retrieve PNR, Database Error', '294' => 'Invalid Format', '295' => 'No Flights Requested', '3' => 'Invalid transfer sequence', '301' => 'Application Suspended', '302' => 'Invalid Length', '304' => 'System Temporarily Unavailable', '305' => 'Security/Audit Failure', '306' => 'Invalid Language Code', '307' => 'Received from data missing', '308' => 'Received from data invalid', '309' => 'Received from data missing or invalid', '310' => 'Ticket arrangement data missing', '311' => 'Ticket arrangement data invalid', '312' => 'Ticket arrangement data missing or invalid', '320' => 'Invalid segment status', '321' => 'Duplicate flight segment', '325' => 'Related system reference error', '326' => 'Sending system reference error', '327' => 'Invalid segment data in itinerary', '328' => 'Invalid aircraft registration', '329' => 'Invalid hold version', '330' => 'invalid loading type', '331' => 'Invalid ULD type', '332' => 'Invalid serial number', '333' => 'Invalid contour/height code', '334' => 'Invalid tare weight', '335' => 'Unit code unknown', '336' => 'Invalid category code', '337' => 'Invalid special load reference', '338' => 'Invalid weight status', '347' => 'Incompatible loads', '348' => 'Invalid flight status', '349' => 'Invalid application/product identification', '352' => 'Link to inventory system is unavailable', '354' => 'Invalid product status', '356' => 'Query control tables full', '357' => 'Declined to process interactively-default to backup', '360' => 'Invalid PNR file address', '361' => 'PNR is secured', '362' => 'Unable to display PNR and/or name list', '363' => 'PNR too long', '364' => 'Invalid ticket number', '365' => 'Invalid responding system in-house code', '366' => 'Name list too long', '367' => 'No active itinerary', '368' => 'Not authorized', '369' => 'No PNR is active, redisplay PNR required', '370' => 'Simultaneous changes to PNR', '371' => 'Prior PNR display required', '375' => 'Requestor not authorized for this function for this PNR', '381' => 'Record locator required', '382' => 'PNR status value not equal', '383' => 'Invalid change to status code', '384' => 'Multiple Name Matches', '385' => 'Mutually exclusive optional parameters', '386' => 'Invalid minimum/maximum connect time specified', '390' => 'Unable to reformat', '391' => 'PNR contains non air segments', '392' => 'Invalid block type/name', '393' => 'Block sell restricted-request block name change', '394' => 'Segment not valid for electronic ticketing', '395' => 'Already ticketed', '396' => 'Invalid ticket/coupon status', '397' => 'Maximum ticket limit reached', '399' => 'Duplicate Name', '4' => 'Invalid city/airport code', '400' => 'Duplicate ticket number', '401' => 'Ticket number not found', '403' => 'Requested Data Not Sorted', '408' => 'No More Data Available', '414' => 'Need Prior Availability Request', '415' => 'Need Prior Schedule Request', '416' => 'Need Prior Timetable Request', '417' => 'Repeat Request Updating in Progress', '437' => 'Carrier must be in separate PNR', '438' => 'Request is outside system date range for this carrier within this system', '440' => 'Void request on already voided or printed coupons', '441' => 'Invalid Priority Number', '442' => 'System in control of device is unknown', '443' => 'Device address is unknown', '445' => 'Security indicator requires originator ID', '448' => 'Contact Service Provider directly', '450' => 'All electronic ticket coupons have been printed', '451' => 'Only individual seat request allowed at this time', '457' => 'Unable-Connection Market Unavailable', '459' => 'Owner Equal to Requestor', '462' => 'Invalid authorization number', '463' => 'Authorization number already used', '466' => 'Form of payment missing or invalid for electronic ticketing', '472' => 'Account does not allow redemption', '473' => 'No award inventory available for requested market and date', '5' => 'Invalid time mode', '6' => 'Invalid operational suffix', '7' => 'Invalid period of schedule validity', '705' => 'Invalid or missing Coupon/Booklet Number', '706' => 'Invalid Certificate Number', '708' => 'Incorrect credit card information', '709' => 'Invalid and/or missing frequent traveler information', '70D' => 'Display criteria not supported', '710' => 'Free text qualifier error', '711' => 'Invalid Fare Calculation Status Code', '712' => 'Missing and/or invalid monetary information', '713' => 'Invalid Price Type Qualifier', '716' => 'Missing and/or invalid reservation control information', '717' => 'Missing and/or invalid travel agent and/or system identification', '718' => 'Invalid Document Type', '721' => 'Too much data', '723' => 'Invalid category', '724' => 'Invalid routing', '725' => 'Domestic itinerary', '726' => 'Invalid global indicator', '727' => 'Invalid amount', '728' => 'Invalid conversion type', '729' => 'Invalid currency code', '738' => 'Overflow', '743' => 'Electronic ticket record purposely not accessable', '745' => 'Refund (full or partial) not allowed', '746' => 'Open segment(s) not permitted for first coupon or entire itinerary', '747' => 'Validity date(s) required for electronic tickets', '748' => 'Status change denied', '749' => 'Coupon status not open', '750' => 'Endorsement restriction', '754' => 'Electronic ticket outside validity date', '755' => 'Invalid exchange/coupon media', '757' => 'Exchange paper to electronic ticket not allowed', '760' => 'Conjunction ticket numbers are not sequential', '761' => 'Exchange/Reissue must include all unused coupons', '762' => 'Invalid tax amount', '763' => 'Invalid tax code', '766' => 'Ticket has no residual value', '767' => 'Historical data not available - unable to process', '790' => 'Exchange denied - no further exchanges allowed', '791' => 'Unable to void exchanged/reissued ticket', '792' => 'Segment not eligible for interline electronic ticket', '793' => 'Fare/tax amount too long', '794' => 'Invalid or missing fare calculation', '795' => 'Invalid, missing or conflicting search criteria', '796' => 'Partial void of ticket coupons not allowed', '797' => 'Invalid stopover indicator', '798' => 'Invalid stopover code usage', '799' => 'Electronic ticket exists, no match on specified criteria', '79A' => 'Invalid office identification', '8' => 'Invalid days of operation', '9' => 'Invalid frequency rate', '900' => 'Inactivity Time Out Value Exceeded', '901' => 'Communications Line Unavailable', '902' => 'Prior message being processed or already processed', '911' => 'Unable to process - system error', '912' => 'Incomplete message - data missing in query', '913' => 'Item/data not found or data not existing in processing host', '914' => 'Invalid format/data - data does not match EDIFACT rules', '915' => 'No action - processing host cannot support function', '916' => 'EDIFACT version not supported', '917' => 'EDIFACT message size exceeded', ]; $errorMessage = (array_key_exists($errorCode, $recognizedErrors)) ? $recognizedErrors[$errorCode] : ''; if ($errorMessage === '') { $errorMessage = "PROCESS E-TICKET ERROR '" . $errorCode . "' (Error message unavailable)"; } return $errorMessage; }
Returns the errortext from a Ticket_ProcessETicketReply errorcode This function is necessary because the core only responds with errorcode but does not send an errortext. The errorcodes for all Queue_*Ticket_ProcessETicketReply messages are the same. @param string $errorCode @return string the errortext for this errorcode.
getErrorTextFromQueueErrorCode
php
amabnl/amadeus-ws-client
src/Amadeus/Client/ResponseHandler/Ticket/HandlerList.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/ResponseHandler/Ticket/HandlerList.php
Apache-2.0
public function analyze(SendResult $response) { //Actually, any error in this call is a SOAPFAULT. return $this->analyzeSimpleResponseErrorCodeAndMessage($response); }
Any response you'll ever get with this message is either a SOAPFAULT or a success. @param SendResult $response @return Result
analyze
php
amabnl/amadeus-ws-client
src/Amadeus/Client/ResponseHandler/PointOfRef/HandlerSearch.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/ResponseHandler/PointOfRef/HandlerSearch.php
Apache-2.0
public function analyze(SendResult $response) { $analyzeResponse = new Result($response); $domXpath = $this->makeDomXpath($response->responseXml); //General error level in the transmissionError location: $errorCodeNodeList = $domXpath->query(self::Q_G_ERR); if ($errorCodeNodeList->length > 0) { $errorCatNode = $domXpath->query(self::Q_G_CAT)->item(0); $analyzeResponse->setStatus($this->makeStatusForPotentiallyNonExistent($errorCatNode)); $code = $errorCodeNodeList->item(0)->nodeValue; $errorTextNodeList = $domXpath->query(self::Q_G_MSG); $message = $this->makeMessageFromMessagesNodeList($errorTextNodeList); $analyzeResponse->messages[] = new Result\NotOk($code, trim($message), 'general'); } //FP level errors via the fopDescription/fpElementError data: $errorCodeNodeList = $domXpath->query(self::Q_F_ERR); if ($errorCodeNodeList->length > 0) { $errorCatNode = $domXpath->query(self::Q_F_CAT)->item(0); $analyzeResponse->setStatus($this->makeStatusForPotentiallyNonExistent($errorCatNode)); $code = $errorCodeNodeList->item(0)->nodeValue; $errorTextNodeList = $domXpath->query(self::Q_F_MSG); $message = $this->makeMessageFromMessagesNodeList($errorTextNodeList); $analyzeResponse->messages[] = new Result\NotOk($code, trim($message), 'fp'); } //Deficient FOP level errors: $errorCodeNodeList = $domXpath->query(self::Q_D_ERR); if ($errorCodeNodeList->length > 0) { $errorCatNode = $domXpath->query(self::Q_D_CAT)->item(0); $analyzeResponse->setStatus($this->makeStatusForPotentiallyNonExistent($errorCatNode)); $code = $errorCodeNodeList->item(0)->nodeValue; $errorTextNodeList = $domXpath->query(self::Q_D_MSG); $message = $this->makeMessageFromMessagesNodeList($errorTextNodeList); $analyzeResponse->messages[] = new Result\NotOk($code, trim($message), 'deficient_fop'); } //authorization failure: $errorCodeNodeList = $domXpath->query(self::Q_A_ERR); if ($errorCodeNodeList->length > 0) { $errorCatNode = $domXpath->query(self::Q_A_CAT)->item(0); $analyzeResponse->setStatus($this->makeStatusForPotentiallyNonExistent($errorCatNode)); $code = $errorCodeNodeList->item(0)->nodeValue; $errorTextNodeList = $domXpath->query(self::Q_A_MSG); $message = $this->makeMessageFromMessagesNodeList($errorTextNodeList); $analyzeResponse->messages[] = new Result\NotOk($code, trim($message), 'authorization_failure'); } return $analyzeResponse; }
FOP_CreateFormOfPayment Analyze the result from the message operation and check for any error messages @param SendResult $response @return Result @throws Exception
analyze
php
amabnl/amadeus-ws-client
src/Amadeus/Client/ResponseHandler/FOP/HandlerCreateFormOfPayment.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/ResponseHandler/FOP/HandlerCreateFormOfPayment.php
Apache-2.0
protected function makeStatusForPotentiallyNonExistent($errorCatNode) { if ($errorCatNode instanceof \DOMNode) { $status = $this->makeStatusFromErrorQualifier($errorCatNode->nodeValue); } else { $status = Result::STATUS_ERROR; } return $status; }
Make status from a category DOMNode or default status. @param \DOMNode|null $errorCatNode @return string
makeStatusForPotentiallyNonExistent
php
amabnl/amadeus-ws-client
src/Amadeus/Client/ResponseHandler/FOP/HandlerCreateFormOfPayment.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/ResponseHandler/FOP/HandlerCreateFormOfPayment.php
Apache-2.0
public function analyze(SendResult $response) { $analyzeResponse = new Result($response); $domXpath = $this->makeDomXpath($response->responseXml); //General error level in the transmissionError location: $errorCodeNodeList = $domXpath->query(self::Q_G_ERR); if ($errorCodeNodeList->length > 0) { $errorCatNode = $domXpath->query(self::Q_G_CAT)->item(0); $analyzeResponse->setStatus($this->makeStatusForPotentiallyNonExistent($errorCatNode)); $code = $errorCodeNodeList->item(0)->nodeValue; $errorTextNodeList = $domXpath->query(self::Q_G_MSG); $message = $this->makeMessageFromMessagesNodeList($errorTextNodeList); $analyzeResponse->messages[] = new Result\NotOk($code, trim($message), 'general'); } //Deficient FOP level errors: $errorCodeNodeList = $domXpath->query(self::Q_D_ERR); if ($errorCodeNodeList->length > 0) { $errorCatNode = $domXpath->query(self::Q_D_CAT)->item(0); $analyzeResponse->setStatus($this->makeStatusForPotentiallyNonExistent($errorCatNode)); $code = $errorCodeNodeList->item(0)->nodeValue; $errorTextNodeList = $domXpath->query(self::Q_D_MSG); $message = $this->makeMessageFromMessagesNodeList($errorTextNodeList); $analyzeResponse->messages[] = new Result\NotOk($code, trim($message), 'deficient_fop'); } return $analyzeResponse; }
FOP_ValidateFormOfPayment Analyze the result from the message operation and check for any error messages @param SendResult $response @return Result @throws Exception
analyze
php
amabnl/amadeus-ws-client
src/Amadeus/Client/ResponseHandler/FOP/HandlerValidateFOP.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/ResponseHandler/FOP/HandlerValidateFOP.php
Apache-2.0
protected function makeStatusForPotentiallyNonExistent($errorCatNode) { if ($errorCatNode instanceof \DOMNode) { $status = $this->makeStatusFromErrorQualifier($errorCatNode->nodeValue); } else { $status = Result::STATUS_ERROR; } return $status; }
Make status from a category DOMNode or default status. @param \DOMNode|null $errorCatNode @return string
makeStatusForPotentiallyNonExistent
php
amabnl/amadeus-ws-client
src/Amadeus/Client/ResponseHandler/FOP/HandlerValidateFOP.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/ResponseHandler/FOP/HandlerValidateFOP.php
Apache-2.0
public function analyze(SendResult $response) { $analyzeResponse = new Result($response); $code = null; $message = null; $domXpath = $this->makeDomXpath($response->responseXml); $categoryNodes = $domXpath->query('//ama_ct:Errors/ama_ct:Error/@Type'); if ($categoryNodes->length > 0) { $analyzeResponse->status = $this->makeStatusFromErrorQualifier($categoryNodes->item(0)->nodeValue); } $codeNodes = $domXpath->query('//ama_ct:Errors/ama_ct:Error/@Code'); if ($codeNodes->length > 0) { $code = $codeNodes->item(0)->nodeValue; } $messageNodes = $domXpath->query('//ama_ct:Errors/ama_ct:Error/@ShortText'); if ($messageNodes->length > 0) { $message = $this->makeMessageFromMessagesNodeList($messageNodes); } if (!is_null($message) && !is_null($code)) { $analyzeResponse->messages[] = new Result\NotOk($code, $message); } return $analyzeResponse; }
Analyze the result from the message operation and check for any error messages @param SendResult $response @return Result @throws Exception
analyze
php
amabnl/amadeus-ws-client
src/Amadeus/Client/ResponseHandler/PAY/HandlerListVirtualCards.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/ResponseHandler/PAY/HandlerListVirtualCards.php
Apache-2.0
public function analyze(SendResult $response) { $analyzeResponse = new Result($response); $code = null; $message = null; $domXpath = $this->makeDomXpath($response->responseXml); $categoryNodes = $domXpath->query('//ama:Errors/ama:Error/@Type'); if ($categoryNodes->length > 0) { $analyzeResponse->status = $this->makeStatusFromErrorQualifier($categoryNodes->item(0)->nodeValue); } $codeNodes = $domXpath->query('//ama:Errors/ama:Error/@Code'); if ($codeNodes->length > 0) { $code = $codeNodes->item(0)->nodeValue; } $messageNodes = $domXpath->query('//ama:Errors/ama:Error/@ShortText'); if ($messageNodes->length > 0) { $message = $this->makeMessageFromMessagesNodeList($messageNodes); } if (!is_null($message) && !is_null($code)) { $analyzeResponse->messages[] = new Result\NotOk($code, $message); } return $this->fillCardDetails($analyzeResponse, $domXpath); }
Analyze the result from the message operation and check for any error messages @param SendResult $response @return Result @throws Exception
analyze
php
amabnl/amadeus-ws-client
src/Amadeus/Client/ResponseHandler/PAY/HandlerGenerateVirtualCard.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/ResponseHandler/PAY/HandlerGenerateVirtualCard.php
Apache-2.0
public function analyze(SendResult $response) { $analyzeResponse = new Result($response); $code = null; $message = null; $domXpath = $this->makeDomXpath($response->responseXml); $categoryNodes = $domXpath->query('//ama:Errors/ama:Error/@Type'); if ($categoryNodes->length > 0) { $analyzeResponse->status = $this->makeStatusFromErrorQualifier($categoryNodes->item(0)->nodeValue); } $codeNodes = $domXpath->query('//ama:Errors/ama:Error/@Code'); if ($codeNodes->length > 0) { $code = $codeNodes->item(0)->nodeValue; } $messageNodes = $domXpath->query('//ama:Errors/ama:Error/@ShortText'); if ($messageNodes->length > 0) { $message = $this->makeMessageFromMessagesNodeList($messageNodes); } if (!is_null($message) && !is_null($code)) { $analyzeResponse->messages[] = new Result\NotOk($code, $message); } return $analyzeResponse; }
Analyze the result from the message operation and check for any error messages @param SendResult $response @return Result @throws Exception
analyze
php
amabnl/amadeus-ws-client
src/Amadeus/Client/ResponseHandler/PAY/HandlerDeleteVirtualCard.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/ResponseHandler/PAY/HandlerDeleteVirtualCard.php
Apache-2.0
public function analyze(SendResult $response) { $analyzeResponse = new Result($response); $code = null; $message = null; $domXpath = $this->makeDomXpath($response->responseXml); $categoryNodes = $domXpath->query('//ama_ct:Errors/ama_ct:Error/@Type'); if ($categoryNodes->length > 0) { $analyzeResponse->status = $this->makeStatusFromErrorQualifier($categoryNodes->item(0)->nodeValue); } $codeNodes = $domXpath->query('//ama_ct:Errors/ama_ct:Error/@Code'); if ($codeNodes->length > 0) { $code = $codeNodes->item(0)->nodeValue; } $messageNodes = $domXpath->query('//ama_ct:Errors/ama_ct:Error/@ShortText'); if ($messageNodes->length > 0) { $message = $this->makeMessageFromMessagesNodeList($messageNodes); } if (!is_null($message) && !is_null($code)) { $analyzeResponse->messages[] = new Result\NotOk($code, $message); return $analyzeResponse; } return $this->fillCardDetails($analyzeResponse, $domXpath); }
Analyze the result from the message operation and check for any error messages @param SendResult $response @return Result @throws Exception
analyze
php
amabnl/amadeus-ws-client
src/Amadeus/Client/ResponseHandler/PAY/HandlerGetVirtualCardDetails.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/ResponseHandler/PAY/HandlerGetVirtualCardDetails.php
Apache-2.0
public function __construct(RequestCreatorParams $params) { $this->params = $params; $this->messagesAndVersions = $params->messagesAndVersions; }
Base Request Creator constructor. @param RequestCreatorParams $params
__construct
php
amabnl/amadeus-ws-client
src/Amadeus/Client/RequestCreator/Base.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/RequestCreator/Base.php
Apache-2.0
public function createRequest($messageName, RequestOptionsInterface $params) { $this->checkMessageIsInWsdl($messageName); $builder = $this->findBuilderForMessage($messageName); if ($builder instanceof ConvertInterface) { return $builder->convert($params, $this->getActiveVersionFor($messageName)); } else { throw new \RuntimeException('No builder found for message '.$messageName); } }
Create a request message for a given message with a set of options. @param string $messageName the message name as named in the WSDL @param RequestOptionsInterface $params @throws Struct\InvalidArgumentException When invalid input is detected during message creation. @throws InvalidMessageException when trying to create a request for a message that is not in your WSDL. @return mixed the created request
createRequest
php
amabnl/amadeus-ws-client
src/Amadeus/Client/RequestCreator/Base.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/RequestCreator/Base.php
Apache-2.0
protected function checkMessageIsInWsdl($messageName) { if (!array_key_exists($messageName, $this->messagesAndVersions)) { throw new InvalidMessageException('Message "'.$messageName.'" is not in WDSL'); } }
Check if a given message is in the active WSDL(s). Throws exception if it isn't. @throws InvalidMessageException if message is not in loaded WSDL(s). @param string $messageName
checkMessageIsInWsdl
php
amabnl/amadeus-ws-client
src/Amadeus/Client/RequestCreator/Base.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/RequestCreator/Base.php
Apache-2.0
protected function getActiveVersionFor($messageName) { $found = null; if (isset($this->messagesAndVersions[$messageName]) && isset($this->messagesAndVersions[$messageName]['version']) ) { $found = $this->messagesAndVersions[$messageName]['version']; } return $found; }
Get the version number active in the WSDL for the given message @param string $messageName @return float|string|null
getActiveVersionFor
php
amabnl/amadeus-ws-client
src/Amadeus/Client/RequestCreator/Base.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/RequestCreator/Base.php
Apache-2.0
protected function findBuilderForMessage($messageName) { $builder = null; if (array_key_exists($messageName, $this->messageBuilders) && $this->messageBuilders[$messageName] instanceof ConvertInterface ) { $builder = $this->messageBuilders[$messageName]; } else { $section = substr($messageName, 0, strpos($messageName, '_')); $message = substr($messageName, strpos($messageName, '_') + 1); $builderClass = __NAMESPACE__.'\\Converter\\'.$section.'\\'.$message."Conv"; if (class_exists($builderClass)) { /** @var ConvertInterface $builder */ $builder = new $builderClass(); $builder->setParams($this->params); $this->messageBuilders[$messageName] = $builder; } } return $builder; }
Find the correct builder for a given message Builder classes implement the ConvertInterface and are used to build only one kind of message. The standard converter class is __NAMESPACE__ \ Converter \ Sectionname \ Messagename + "Conv" e.g. Amadeus\Client\RequestCreator\Converter\DocIssuance\IssueTicketConv @param string $messageName @return ConvertInterface|null
findBuilderForMessage
php
amabnl/amadeus-ws-client
src/Amadeus/Client/RequestCreator/Base.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/RequestCreator/Base.php
Apache-2.0
public function extract($soapResponse) { $messageBody = null; $messageBody = $this->getStringBetween($soapResponse, '<SOAP-ENV:Body>', '</SOAP-ENV:Body>'); if (empty($messageBody) || false === $messageBody) { $messageBody = $this->getStringBetween($soapResponse, '<soap:Body>', '</soap:Body>'); } return $messageBody; }
Extracts the message content from the soap envelope (i.e. everything under the soap body) @param string $soapResponse @return string|null
extract
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Util/MsgBodyExtractor.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Util/MsgBodyExtractor.php
Apache-2.0
private function getStringBetween($string, $start, $end) { $startPos = strpos($string, $start) + strlen($start); $endPos = strlen($string) - strpos($string, $end); return substr($string, $startPos, -$endPos); }
Get substring between two strings @param $string @param $start @param $end @return bool|string
getStringBetween
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Util/MsgBodyExtractor.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Util/MsgBodyExtractor.php
Apache-2.0
public static function generateSomewhatRandomString($length = 22) { $chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"; mt_srand((int)microtime(true) * 1000000); $i = 0; $somewhatRandom = ''; while ($i < $length) { $num = rand() % 60; $tmp = substr($chars, $num, 1); $somewhatRandom = $somewhatRandom.$tmp; $i++; } return $somewhatRandom; }
Generates a somewhat random string of a given length @param int $length @return string
generateSomewhatRandomString
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Util/SomewhatRandomGenerator.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Util/SomewhatRandomGenerator.php
Apache-2.0
protected static function loadNonceBase($handlerParams) { if (empty($handlerParams->authParams->nonceBase)) { $handlerParams->authParams->nonceBase = SomewhatRandomGenerator::generateSomewhatRandomString(); } return $handlerParams; }
Get the NONCE base to be used when generating somewhat random nonce strings From the NONCE base file, or fallback is a new somewhat random string each instantiation. @param SessionHandlerParams $handlerParams @return SessionHandlerParams
loadNonceBase
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Session/Handler/HandlerFactory.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Session/Handler/HandlerFactory.php
Apache-2.0
protected function prepareForNextMessage($messageName, $messageOptions) { if (!$this->isAuthenticated && $messageName !== 'Security_Authenticate') { throw new InvalidSessionException('No active session'); } $this->getSoapClient($messageName)->__setSoapHeaders(null); if ($this->isAuthenticated === true && is_int($this->sessionData['sequenceNumber'])) { $this->sessionData['sequenceNumber']++; $session = new Client\Struct\HeaderV2\Session( $this->sessionData['sessionId'], $this->sessionData['sequenceNumber'], $this->sessionData['securityToken'] ); $this->getSoapClient($messageName)->__setSoapHeaders( new \SoapHeader(self::CORE_WS_V2_SESSION_NS, self::NODENAME_SESSION, $session) ); } }
Prepare to send a next message and checks if authenticated @param string $messageName @param array $messageOptions @throws InvalidSessionException When trying to send a message without session.
prepareForNextMessage
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Session/Handler/SoapHeader2.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Session/Handler/SoapHeader2.php
Apache-2.0
protected function handlePostMessage($messageName, $lastResponse, $messageOptions, $result) { if ($messageName === "Security_Authenticate") { $this->sessionData = $this->getSessionDataFromHeader($lastResponse); $this->isAuthenticated = (!empty($this->sessionData['sessionId']) && !empty($this->sessionData['sequenceNumber']) && !empty($this->sessionData['securityToken'])); } }
Handles post message actions Handles session state based on received response @param string $messageName @param string $lastResponse @param array $messageOptions @param mixed $result
handlePostMessage
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Session/Handler/SoapHeader2.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Session/Handler/SoapHeader2.php
Apache-2.0
public function setStateful($stateful) { if ($stateful === false) { throw new UnsupportedOperationException('Stateful messages are mandatory on SoapHeader 2'); } }
Cannot set stateless on Soap Header v2 @param bool $stateful @throws UnsupportedOperationException
setStateful
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Session/Handler/SoapHeader2.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Session/Handler/SoapHeader2.php
Apache-2.0
public function isStateful() { return true; }
Soap Header 2 sessions are always stateful @return bool
isStateful
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Session/Handler/SoapHeader2.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Session/Handler/SoapHeader2.php
Apache-2.0
public function isTransactionFlowLinkEnabled() { return false; //Not supported }
Is the TransactionFlowLink header enabled? @return bool
isTransactionFlowLinkEnabled
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Session/Handler/SoapHeader2.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Session/Handler/SoapHeader2.php
Apache-2.0
public function setTransactionFlowLink($enabled) { if ($enabled === true) { throw new UnsupportedOperationException('TransactionFlowLink header is not supported on SoapHeader 2'); } }
Enable or disable TransactionFlowLink header @throws UnsupportedOperationException when used on unsupported WSAP versions @param bool $enabled
setTransactionFlowLink
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Session/Handler/SoapHeader2.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Session/Handler/SoapHeader2.php
Apache-2.0
public function getConsumerId() { return null; //Not supported }
Get the TransactionFlowLink Consumer ID @return string|null
getConsumerId
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Session/Handler/SoapHeader2.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Session/Handler/SoapHeader2.php
Apache-2.0
public function setConsumerId($id) { if (!is_null($id)) { throw new UnsupportedOperationException('TransactionFlowLink header is not supported on SoapHeader 2'); } }
Set the TransactionFlowLink Consumer ID @throws UnsupportedOperationException when used on unsupported WSAP versions @param string $id @return void
setConsumerId
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Session/Handler/SoapHeader2.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Session/Handler/SoapHeader2.php
Apache-2.0
protected function makeSoapClientOptions() { $options = $this->soapClientOptions; $options['classmap'] = array_merge(Classmap::$soapheader2map, Classmap::$map); if (!empty($this->params->soapClientOptions)) { $options = array_merge($options, $this->params->soapClientOptions); } return $options; }
Make SoapClient options for Soap Header 2 handler @return array
makeSoapClientOptions
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Session/Handler/SoapHeader2.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Session/Handler/SoapHeader2.php
Apache-2.0
protected static function getMessagesAndVersionsFromImportedWsdl($import, $wsdlPath, $wsdlIdentifier) { $msgAndVer = []; $domXpath = null; $importPath = realpath(dirname($wsdlPath)).DIRECTORY_SEPARATOR.$import; try { $wsdlContent = file_get_contents($importPath); } catch (\Throwable) { // swallow to throw exception below $wsdlContent = false; } if ($wsdlContent !== false) { $domDoc = new \DOMDocument('1.0', 'UTF-8'); $ok = $domDoc->loadXML($wsdlContent); if ($ok === true) { $domXpath = new \DOMXPath($domDoc); $domXpath->registerNamespace( 'wsdl', 'http://schemas.xmlsoap.org/wsdl/' ); $domXpath->registerNamespace( 'soap', 'http://schemas.xmlsoap.org/wsdl/soap/' ); } } else { throw new InvalidWsdlFileException('WSDL '.$importPath.' import could not be loaded'); } if ($domXpath instanceof \DOMXPath) { $nodeList = $domXpath->query(self::XPATH_ALL_OPERATIONS); $msgAndVer = array_merge( $msgAndVer, self::loopOperationsWithQuery( $nodeList, self::XPATH_ALT_VERSION_FOR_OPERATION, $wsdlIdentifier, $domXpath ) ); } return $msgAndVer; }
Get Messages & Versions from an imported WSDL file Imported wsdl's are a little different, they require a different query to extract the version nrs. @param string $import @param string $wsdlPath @param string $wsdlIdentifier @return array @throws InvalidWsdlFileException when the WSDL import could not be loaded.
getMessagesAndVersionsFromImportedWsdl
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Session/Handler/WsdlAnalyser.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Session/Handler/WsdlAnalyser.php
Apache-2.0
public static function loadWsdlXpath($wsdlFilePath, $wsdlId) { if (!isset(self::$wsdlDomXpath[$wsdlId]) || is_null(self::$wsdlDomXpath[$wsdlId])) { try { $wsdlContent = file_get_contents($wsdlFilePath); } catch (\Throwable) { // swallow to throw exception below $wsdlContent = false; } if ($wsdlContent !== false) { self::$wsdlDomDoc[$wsdlId] = new \DOMDocument('1.0', 'UTF-8'); self::$wsdlDomDoc[$wsdlId]->loadXML($wsdlContent); self::$wsdlDomXpath[$wsdlId] = new \DOMXPath(self::$wsdlDomDoc[$wsdlId]); self::$wsdlDomXpath[$wsdlId]->registerNamespace( 'wsdl', 'http://schemas.xmlsoap.org/wsdl/' ); self::$wsdlDomXpath[$wsdlId]->registerNamespace( 'soap', 'http://schemas.xmlsoap.org/wsdl/soap/' ); } else { throw new InvalidWsdlFileException('WSDL '.$wsdlFilePath.' could not be loaded'); } } }
Load the WSDL contents to a queryable DOMXpath. @param string $wsdlFilePath @param string $wsdlId @uses $this->wsdlDomDoc @uses $this->wsdlDomXpath @throws InvalidWsdlFileException when WSDL cannot be found.
loadWsdlXpath
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Session/Handler/WsdlAnalyser.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Session/Handler/WsdlAnalyser.php
Apache-2.0
protected static function extractMessageVersion($fullVersionString) { $marker = strpos($fullVersionString, '_', strpos($fullVersionString, '_') + 1); $num = substr($fullVersionString, $marker + 1); return str_replace('_', '.', $num); }
extractMessageVersion extracts "4.1" from a string like "Security_SignOut_4_1" or "1.00" from a string like "tns:AMA_MediaGetMediaRQ_1.000" @param string $fullVersionString @return string
extractMessageVersion
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Session/Handler/WsdlAnalyser.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Session/Handler/WsdlAnalyser.php
Apache-2.0
protected static function makeWsdlIdentifier($wsdlPath) { return sprintf('%x', crc32($wsdlPath)); }
Generates a unique identifier for a wsdl based on its path. @param string $wsdlPath @return string
makeWsdlIdentifier
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Session/Handler/WsdlAnalyser.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Session/Handler/WsdlAnalyser.php
Apache-2.0
public static function exaluateXpathQueryOnWsdl($wsdlId, $wsdlFilePath, $xpath) { WsdlAnalyser::loadWsdlXpath($wsdlFilePath, $wsdlId); return self::$wsdlDomXpath[$wsdlId]->evaluate($xpath); }
Evaluate an XPATH query on a given WSDL @param string $wsdlId @param string $wsdlFilePath @param string $xpath XPATH query @return string|null
exaluateXpathQueryOnWsdl
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Session/Handler/WsdlAnalyser.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Session/Handler/WsdlAnalyser.php
Apache-2.0
protected static function loopOperationsWithQuery($operations, $query, $wsdlIdentifier, $domXpath) { $msgAndVer = []; foreach ($operations as $operation) { if (!empty($operation->value)) { $fullVersion = $domXpath->evaluate( sprintf($query, $operation->value) ); if (!empty($fullVersion)) { $extractedVersion = self::extractMessageVersion($fullVersion); $msgAndVer[$operation->value] = [ 'version' => $extractedVersion, 'wsdl' => $wsdlIdentifier ]; } } } return $msgAndVer; }
Loop all extracted operations from a wsdl and find their message versions @param \DOMNodeList $operations @param string $query @param string $wsdlIdentifier @param \DOMXPath $domXpath @return array
loopOperationsWithQuery
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Session/Handler/WsdlAnalyser.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Session/Handler/WsdlAnalyser.php
Apache-2.0
public function getSessionData() { return $this->sessionData; }
Get the session parameters of the active session @return array|null
getSessionData
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Session/Handler/Base.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Session/Handler/Base.php
Apache-2.0
public function setSessionData(array $sessionData) { if (isset($sessionData['sessionId'], $sessionData['sequenceNumber'], $sessionData['securityToken'])) { $this->sessionData['sessionId'] = $sessionData['sessionId']; $this->sessionData['sequenceNumber'] = $sessionData['sequenceNumber']; $this->sessionData['securityToken'] = $sessionData['securityToken']; $this->isAuthenticated = true; } else { $this->isAuthenticated = false; } return $this->isAuthenticated; }
Set the session data to continue a previously started session. @param array $sessionData @return bool
setSessionData
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Session/Handler/Base.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Session/Handler/Base.php
Apache-2.0
public function getLastRequest($msgName) { return $this->executeMethodOnSoapClientForMsg( $msgName, '__getLastRequest' ); }
Get the last raw XML message that was sent out @param string $msgName @return string|null
getLastRequest
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Session/Handler/Base.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Session/Handler/Base.php
Apache-2.0
public function getLastResponse($msgName) { return $this->executeMethodOnSoapClientForMsg( $msgName, '__getLastResponse' ); }
Get the last raw XML message that was received @param string $msgName @return string|null
getLastResponse
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Session/Handler/Base.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Session/Handler/Base.php
Apache-2.0
public function getLastRequestHeaders($msgName) { return $this->executeMethodOnSoapClientForMsg( $msgName, '__getLastRequestHeaders' ); }
Get the request headers for the last SOAP message that was sent out @param string $msgName @return string|null
getLastRequestHeaders
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Session/Handler/Base.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Session/Handler/Base.php
Apache-2.0
public function getLastResponseHeaders($msgName) { return $this->executeMethodOnSoapClientForMsg( $msgName, '__getLastResponseHeaders' ); }
Get the response headers for the last SOAP message that was received @param string $msgName @return string|null
getLastResponseHeaders
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Session/Handler/Base.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Session/Handler/Base.php
Apache-2.0
public function getOriginatorOffice() { return $this->params->authParams->officeId; }
Get the office that we are using to sign in to. @return string
getOriginatorOffice
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Session/Handler/Base.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Session/Handler/Base.php
Apache-2.0
public function getMessagesAndVersions() { if (empty($this->messagesAndVersions)) { $this->messagesAndVersions = WsdlAnalyser::loadMessagesAndVersions($this->params->wsdl); } return $this->messagesAndVersions; }
Extract the Messages and versions from the loaded WSDL file. Result is an associative array: keys are message names, values are versions. @return array
getMessagesAndVersions
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Session/Handler/Base.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Session/Handler/Base.php
Apache-2.0
protected function getActiveVersionFor($messageName) { $msgAndVer = $this->getMessagesAndVersions(); $found = null; if (isset($msgAndVer[$messageName]) && isset($msgAndVer[$messageName]['version'])) { $found = $msgAndVer[$messageName]['version']; } return $found; }
Get the version number active in the WSDL for the given message @param $messageName @return float|string|null
getActiveVersionFor
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Session/Handler/Base.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Session/Handler/Base.php
Apache-2.0
protected function getWsdlIdFor($messageName) { $msgAndVer = $this->getMessagesAndVersions(); if (isset($msgAndVer[$messageName]) && isset($msgAndVer[$messageName]['wsdl'])) { return $msgAndVer[$messageName]['wsdl']; } return null; }
Get the WSDL ID for the given message @param $messageName @return string|null
getWsdlIdFor
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Session/Handler/Base.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Session/Handler/Base.php
Apache-2.0
protected function getSoapClient($msgName) { $wsdlId = $this->getWsdlIdFor($msgName); if (!empty($msgName)) { if (!isset($this->soapClients[$wsdlId]) || !($this->soapClients[$wsdlId] instanceof \SoapClient)) { $this->soapClients[$wsdlId] = $this->initSoapClient($wsdlId); } return $this->soapClients[$wsdlId]; } else { return null; } }
Get the appropriate SoapClient for a given message (depends on which WSDL the message is defined in) @param string $msgName @return \SoapClient
getSoapClient
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Session/Handler/Base.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Session/Handler/Base.php
Apache-2.0
protected function initSoapClient($wsdlId) { // d($wsdlId); $wsdlPath = WsdlAnalyser::$wsdlIds[$wsdlId]; $client = new Client\SoapClient( $wsdlPath, $this->makeSoapClientOptions(), $this->params->logger ); return $client; }
Initialize SoapClient for a given WSDL ID @param string $wsdlId @return \SoapClient
initSoapClient
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Session/Handler/Base.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Session/Handler/Base.php
Apache-2.0
protected function executeMethodOnSoapClientForMsg($msgName, $method) { $result = null; $soapClient = $this->getSoapClient($msgName); if ($soapClient instanceof \SoapClient) { $result = $soapClient->$method(); } return $result; }
Execute a method on the native SoapClient @param string $msgName @param string $method @return null|string
executeMethodOnSoapClientForMsg
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Session/Handler/Base.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Session/Handler/Base.php
Apache-2.0
public function isStateful() { return $this->isStateful; }
Check whether we are running in stateful mode (true) or in stateless mode (false) @return bool
isStateful
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Session/Handler/SoapHeader4.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Session/Handler/SoapHeader4.php
Apache-2.0
public function isTransactionFlowLinkEnabled() { return $this->enableTransactionFlowLink; }
Is the TransactionFlowLink header enabled? @return bool
isTransactionFlowLinkEnabled
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Session/Handler/SoapHeader4.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Session/Handler/SoapHeader4.php
Apache-2.0
public function setTransactionFlowLink($enabled) { $this->enableTransactionFlowLink = $enabled; }
Enable or disable TransactionFlowLink header @param bool $enabled
setTransactionFlowLink
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Session/Handler/SoapHeader4.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Session/Handler/SoapHeader4.php
Apache-2.0
public function getConsumerId($generate = false) { if (is_null($this->consumerId) && $generate) { $this->consumerId = $this->generateGuid(); } return $this->consumerId; }
Get the TransactionFlowLink Consumer ID @param bool $generate Whether to generate a consumer ID @return string|null
getConsumerId
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Session/Handler/SoapHeader4.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Session/Handler/SoapHeader4.php
Apache-2.0
public function setConsumerId($id) { $this->consumerId = $id; }
Set the TransactionFlowLink Consumer ID @param string $id @return void
setConsumerId
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Session/Handler/SoapHeader4.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Session/Handler/SoapHeader4.php
Apache-2.0
protected function prepareForNextMessage($messageName, $messageOptions) { if ($this->isAuthenticated === true && is_int($this->sessionData['sequenceNumber'])) { $this->sessionData['sequenceNumber']++; } $headers = $this->createSoapHeaders($this->sessionData, $this->params, $messageName, $messageOptions); $this->getSoapClient($messageName)->__setSoapHeaders(null); $this->getSoapClient($messageName)->__setSoapHeaders($headers); }
Handles authentication & sessions If authenticated, increment sequence number for next message and set session info to soapheader If not, set auth info to soapheader @uses $this->isAuthenticated @uses $this->sessionData @param string $messageName @param array $messageOptions
prepareForNextMessage
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Session/Handler/SoapHeader4.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Session/Handler/SoapHeader4.php
Apache-2.0
protected function handlePostMessage($messageName, $lastResponse, $messageOptions, $result) { //CHECK FOR SESSION DATA: if ($this->isStateful() === true) { //We need to extract session info $this->sessionData = $this->getSessionDataFromHeader($lastResponse); $this->isAuthenticated = (!empty($this->sessionData['sessionId']) && !empty($this->sessionData['sequenceNumber']) && !empty($this->sessionData['securityToken'])); } else { $this->isAuthenticated = false; } }
Handles post message actions - look for session info and set status variables - checks for message errors? - ends terminated sessions @param string $messageName @param string $lastResponse @param array $messageOptions @param mixed $result @return void
handlePostMessage
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Session/Handler/SoapHeader4.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Session/Handler/SoapHeader4.php
Apache-2.0
protected function getEndpointFromWsdl($wsdlFilePath, $messageName) { $wsdlId = $this->getWsdlIdFor($messageName); return WsdlAnalyser::exaluateXpathQueryOnWsdl( $wsdlId, $wsdlFilePath, self::XPATH_ENDPOINT ); }
Get the Web Services server Endpoint from the WSDL. @param string $wsdlFilePath @param string $messageName @return string|null
getEndpointFromWsdl
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Session/Handler/SoapHeader4.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Session/Handler/SoapHeader4.php
Apache-2.0
protected function getActionFromWsdl($wsdlFilePath, $messageName) { $wsdlId = $this->getWsdlIdFor($messageName); return WsdlAnalyser::exaluateXpathQueryOnWsdl( $wsdlId, $wsdlFilePath, sprintf(self::XPATH_OPERATION_ACTION, $messageName) ); }
Get the SOAPAction for a given message from the WSDL contents. @param string $wsdlFilePath @param string $messageName @return string|null
getActionFromWsdl
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Session/Handler/SoapHeader4.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Session/Handler/SoapHeader4.php
Apache-2.0
protected function generatePasswordDigest($password, $creationString, $messageNonce) { return base64_encode(sha1($messageNonce . $creationString . sha1($password, true), true)); }
Generates a Password Digest following this algorithm: HashedPassword = Base64(SHA-1( nonce + created + SHA-1 ( password ))) as defined in https://webservices.amadeus.com/extranet/kdbViewDocument.do?externalId=wikidoc_web_services_embedded_security_implementation_guide_header_entries_ws-security_usernametoken&docStatus=Published&mpId=fla__1__technical EXAMPLE: with: Nonce in Base 64 = 'PZgFvh5439plJpKpIyf5ucmXhNU=' Timestamp = '2013-01-11T09:41:03Z' Clear Password = 'WBSPassword' The digest algorithm returns the Encrypted Password in Base 64: HshPwd = 'ic3AOJElVpvkz9ZBKd105Siry28=' @param string $password CLEARTEXT password (NOT the base64 encoded password used in Security_Authenticate) @param string $creationString message creation datetime UTC Format: yyyy-mm-ddTHH:MM:SSZ or yyyy-mm-ddTHH:MM:SS.sssZ @param string $messageNonce Random unique string @return string The generated Password Digest
generatePasswordDigest
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Session/Handler/SoapHeader4.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Session/Handler/SoapHeader4.php
Apache-2.0
protected function makeSoapClientOptions() { $options = $this->soapClientOptions; $options['classmap'] = array_merge(Classmap::$soapheader4map, Classmap::$map); if (!empty($this->params->soapClientOptions)) { $options = array_merge($options, $this->params->soapClientOptions); } return $options; }
Make SoapClient options for Soap Header 4 handler @return array
makeSoapClientOptions
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Session/Handler/SoapHeader4.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Session/Handler/SoapHeader4.php
Apache-2.0
protected function isNotSecurityAuthenticateMessage($messageName) { return 'Security_Authenticate' !== $messageName; }
Check is called message is not Security_Authenticate. @param $messageName @return bool
isNotSecurityAuthenticateMessage
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Session/Handler/SoapHeader4.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Session/Handler/SoapHeader4.php
Apache-2.0
private function getStatefulStatusCode($messageName, array $messageOptions) { // on security-auth this is always 'Start' if ('Security_Authenticate' === $messageName) { return self::TRANSACTION_STATUS_CODE_START; } // if endSession is set this will be (the) 'End' if (isset($messageOptions['endSession']) && $messageOptions['endSession'] === true) { return self::TRANSACTION_STATUS_CODE_END; } // on everything else we assume in-series return self::TRANSACTION_STATUS_CODE_INSERIES; }
Return transaction code for stateful requests. @param string $messageName name of request message (e.g. Security_Authenticate) @param array $messageOptions @return string
getStatefulStatusCode
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Session/Handler/SoapHeader4.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Session/Handler/SoapHeader4.php
Apache-2.0
protected function loadFromArray(array $params) { if (count($params) > 0) { if (isset($params['soapHeaderVersion'])) { $this->soapHeaderVersion = $params['soapHeaderVersion']; } $this->loadWsdl($params); $this->loadStateful($params); $this->loadLogger($params); $this->loadAuthParams($params); $this->loadOverrideSoapClient($params); $this->loadSoapClientOptions($params); $this->loadTransactionFlowLink($params); } }
Load parameters from an associative array @param array $params @return void
loadFromArray
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Params/SessionHandlerParams.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Params/SessionHandlerParams.php
Apache-2.0
protected function loadWsdl($params) { if (isset($params['wsdl'])) { if (is_string($params['wsdl'])) { $this->wsdl = [ $params['wsdl'] ]; } elseif (is_array($params['wsdl'])) { $this->wsdl = $params['wsdl']; } } }
Load WSDL from config Either a single WSDL location as string or a list of WSDL locations as array. @param array $params @return void
loadWsdl
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Params/SessionHandlerParams.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Params/SessionHandlerParams.php
Apache-2.0
protected function loadStateful($params) { $this->stateful = (isset($params['stateful'])) ? $params['stateful'] : true; }
Load Stateful param from config @param array $params @return void
loadStateful
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Params/SessionHandlerParams.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Params/SessionHandlerParams.php
Apache-2.0
protected function loadOverrideSoapClient($params) { if (isset($params['overrideSoapClient']) && $params['overrideSoapClient'] instanceof \SoapClient) { $this->overrideSoapClient = $params['overrideSoapClient']; } if (isset($params['overrideSoapClientWsdlName'])) { $this->overrideSoapClientWsdlName = $params['overrideSoapClientWsdlName']; } }
Load Override SoapClient parameter from config @param array $params @return void
loadOverrideSoapClient
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Params/SessionHandlerParams.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Params/SessionHandlerParams.php
Apache-2.0
protected function loadSoapClientOptions($params) { if (isset($params['soapClientOptions']) && is_array($params['soapClientOptions'])) { $this->soapClientOptions = $params['soapClientOptions']; } }
Load SoapClient Options from config @param array $params @return void
loadSoapClientOptions
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Params/SessionHandlerParams.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Params/SessionHandlerParams.php
Apache-2.0
protected function loadTransactionFlowLink($params) { if (isset($params['enableTransactionFlowLink']) && $params['enableTransactionFlowLink'] === true) { $this->enableTransactionFlowLink = true; $this->consumerId = (isset($params['consumerId'])) ? $params['consumerId'] : null; } }
Load TransactionFlowLink options from config @param array $params @return void
loadTransactionFlowLink
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Params/SessionHandlerParams.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Params/SessionHandlerParams.php
Apache-2.0
protected function loadFromArray(array $params) { if (count($params) > 0) { $this->officeId = $params['officeId']; $this->originatorTypeCode = (isset($params['originatorTypeCode'])) ? $params['originatorTypeCode'] : "U"; $this->dutyCode = (isset($params['dutyCode'])) ? $params['dutyCode'] : "SU"; $this->userId = $params['userId']; $this->organizationId = (isset($params['organizationId'])) ? $params['organizationId'] : null; $this->passwordLength = (isset($params['passwordLength'])) ? $params['passwordLength'] : null; $this->passwordData = $params['passwordData']; if (isset($params['nonceBase'])) { $this->nonceBase = $params['nonceBase']; } } }
Load parameters from an associative array @param array $params @return void
loadFromArray
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Params/AuthParams.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Params/AuthParams.php
Apache-2.0
protected function checkAnyNotEmpty() { $foundNotEmpty = false; $args = func_get_args(); foreach ($args as $arg) { if (!empty($arg)) { $foundNotEmpty = true; break; } } return $foundNotEmpty; }
Check if any parameter to the current function is not empty @param mixed @return boolean true if at least 1 parameter is not empty
checkAnyNotEmpty
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Struct/WsMessageUtility.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Struct/WsMessageUtility.php
Apache-2.0
protected function checkAllNotEmpty() { $foundEmpty = false; $args = func_get_args(); foreach ($args as $arg) { if (empty($arg)) { $foundEmpty = true; break; } } return !$foundEmpty; }
Check if all parameters to the current function are not empty @param mixed @return boolean true if all parameters are not empty
checkAllNotEmpty
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Struct/WsMessageUtility.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Struct/WsMessageUtility.php
Apache-2.0
protected function checkAllIntegers() { $foundNonInt = false; $args = func_get_args(); foreach ($args as $arg) { if (!is_int($arg)) { $foundNonInt = true; break; } } return !$foundNonInt; }
Check if all parameters to the current function are integers @param mixed @return boolean true if all parameters are integers
checkAllIntegers
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Struct/WsMessageUtility.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Struct/WsMessageUtility.php
Apache-2.0
protected function checkAnyTrue() { $foundTrue = false; $args = func_get_args(); foreach ($args as $arg) { if ($arg === true) { $foundTrue = true; break; } } return $foundTrue; }
Check if any parameter to the current function is true @param mixed @return boolean true if at least 1 parameter is true
checkAnyTrue
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Struct/WsMessageUtility.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Struct/WsMessageUtility.php
Apache-2.0
protected function loadBare(PnrAddMultiElementsOptions $params) { $tattooCounter = 0; if (!is_null($params->actionCode)) { $this->pnrActions = new AddMultiElements\PnrActions( $params->actionCode ); } if (!is_null($params->recordLocator)) { $this->reservationInfo = new AddMultiElements\ReservationInfo($params->recordLocator); } if ($params->travellerGroup !== null) { $this->addTravellerGroup($params->travellerGroup); } else { $this->addTravellers($params->travellers); } $this->addItineraries($params->itineraries, $params->tripSegments, $tattooCounter); if (!empty($params->elements)) { $this->addElements( $params->elements, $tattooCounter, $params->autoAddReceivedFrom, $params->defaultReceivedFrom, $params->receivedFrom ); } else { $this->addReceivedFrom( $params->receivedFrom, $params->autoAddReceivedFrom, $params->defaultReceivedFrom, $tattooCounter ); } }
PNR_AddMultiElements call which only adds requested data to the message For doing specific actions like ignoring or saving PNR. @param PnrAddMultiElementsOptions $params @throws \ReflectionException
loadBare
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Struct/Pnr/AddMultiElements.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Struct/Pnr/AddMultiElements.php
Apache-2.0
protected function loadCreatePnr(PnrCreatePnrOptions $params) { $this->pnrActions = new AddMultiElements\PnrActions( $params->actionCode ); $tattooCounter = 0; if ($params->travellerGroup !== null) { $this->addTravellerGroup($params->travellerGroup); } else { $this->addTravellers($params->travellers); } $this->addItineraries($params->itineraries, $params->tripSegments, $tattooCounter); $this->addElements( $params->elements, $tattooCounter, $params->autoAddReceivedFrom, $params->defaultReceivedFrom, $params->receivedFrom ); }
Make PNR_AddMultiElements structure from a PnrCreatePnrOptions input. @throws InvalidArgumentException When invalid input is provided @param PnrCreatePnrOptions $params @throws \ReflectionException
loadCreatePnr
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Struct/Pnr/AddMultiElements.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Struct/Pnr/AddMultiElements.php
Apache-2.0
protected function addReceivedFrom($explicitRf, $doAutoAdd, $defaultRf, &$tattooCounter) { if ($this->dataElementsMaster === null) { $this->dataElementsMaster = new DataElementsMaster(); } if (!empty($explicitRf) || ($doAutoAdd && !empty($defaultRf))) { //Set a received from if explicitly provided or if auto received from is enabled $tattooCounter++; $rfToAdd = (!empty($explicitRf)) ? $explicitRf : $defaultRf; $this->dataElementsMaster->dataElementsIndiv[] = $this->createElement( new ReceivedFrom(['receivedFrom' => $rfToAdd]), $tattooCounter ); } }
Add Received From field - if needed. @param string|null $explicitRf Explicitly provided RF string on request. @param bool $doAutoAdd Wether to automatically add an RF field. @param string|null $defaultRf The default RF string set in the client. @param int $tattooCounter (BYREF) @throws \ReflectionException
addReceivedFrom
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Struct/Pnr/AddMultiElements.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Struct/Pnr/AddMultiElements.php
Apache-2.0
public function __construct($options) { // Determine retrieval type depending on which options were provided. // Also, maintain backwards compatibility with how this message previously worked: // Warning, this won't work when combining options. In that case you'll get a soapfault from Amadeus. if (is_null($options->retrievalType)) { if (!empty($options->recordLocator)) { $options->retrievalType = self::RETR_TYPE_BY_RECLOC; } elseif (!empty($options->customerProfile)) { $options->retrievalType = self::RETR_TYPE_BY_CUSTOMER_PROFILE; } elseif (!empty($options->accountNumber)) { $options->retrievalType = self::RETR_TYPE_BY_ACCOUNT_NUMBER; } elseif (!empty($options->frequentTraveller)) { $options->retrievalType = self::RETR_TYPE_BY_FREQUENT_TRAVELLER; } elseif ($this->checkAnyNotEmpty($options->service)) { $options->retrievalType = self::RETR_TYPE_BY_SERVICE_AND_NAME; } elseif ($this->checkAnyNotEmpty($options->lastName, $options->officeId)) { $options->retrievalType = self::RETR_TYPE_BY_OFFICE_AND_NAME; } elseif (!$options->recordLocator) { $options->retrievalType = self::RETR_TYPE_ACTIVE_PNR; } } $this->retrievalFacts = new Retrieve\RetrievalFacts($options); }
Construct PNR_Retrieve message @param PnrRetrieveOptions $options
__construct
php
amabnl/amadeus-ws-client
src/Amadeus/Client/Struct/Pnr/Retrieve.php
https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Struct/Pnr/Retrieve.php
Apache-2.0