Skip to content

Commit

Permalink
Merge 41f760e into 83dd319
Browse files Browse the repository at this point in the history
  • Loading branch information
m0veax committed Mar 28, 2018
2 parents 83dd319 + 41f760e commit 54fc202
Show file tree
Hide file tree
Showing 6 changed files with 570 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/how-to.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ After doing multiple calls with a stateful session, there are two ways to end th

.. code-block:: php
$client->signOut(); //Terminates an active stateful session. There is no active session with stateless messages.
$client->securitySignOut(); //Terminates an active stateful session. There is no active session with stateless messages.
- set an 'endSession' message option on the last call you want to make:

Expand Down
20 changes: 20 additions & 0 deletions src/Amadeus/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,26 @@ public function offerConfirmCar(RequestOptions\OfferConfirmCarOptions $options,
return $this->callMessage($msgName, $options, $messageOptions);
}

/**
* Fare_MasterPricerExpertSearch
*
* @param RequestOptions\FareMasterPricerExSearch $options
* @param array $messageOptions (OPTIONAL)
* @return Result
* @throws Client\InvalidMessageException
* @throws Client\RequestCreator\MessageVersionUnsupportedException
* @throws Exception
*/
public function fareMasterPricerExpertSearch(
RequestOptions\FareMasterPricerExSearch $options,
$messageOptions = []
) {
$msgName = 'Fare_MasterPricerExpertSearch';

return $this->callMessage($msgName, $options, $messageOptions);
}


/**
* Fare_MasterPricerTravelBoardSearch
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php
/**
* amadeus-ws-client
*
* Copyright 2015 Amadeus Benelux NV
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @package Amadeus
* @license https://opensource.org/licenses/Apache-2.0 Apache 2.0
*/

namespace Amadeus\Client\RequestCreator\Converter\Fare;

use Amadeus\Client\RequestCreator\Converter\BaseConverter;
use Amadeus\Client\RequestOptions\FareMasterPricerExSearch;
use Amadeus\Client\Struct;

/**
* Fare_MasterPricerExpertSearch Request converter
*
* @package Amadeus\Client\RequestCreator\Converter\Fare
* @author Dieter Devlieghere <dermikagh@gmail.com>
*/
class MasterPricerExpertSearchConv extends BaseConverter
{
/**
* @param FareMasterPricerExSearch $requestOptions
* @param int|string $version
* @return Struct\Fare\MasterPricerExpertSearch
*/
public function convert($requestOptions, $version)
{
return new Struct\Fare\MasterPricerExpertSearch($requestOptions);
}
}
189 changes: 189 additions & 0 deletions src/Amadeus/Client/RequestOptions/FareMasterPricerExSearch.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
<?php
/**
* amadeus-ws-client
*
* Copyright 2015 Amadeus Benelux NV
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @package Amadeus
* @license https://opensource.org/licenses/Apache-2.0 Apache 2.0
*/

namespace Amadeus\Client\RequestOptions;

/**
* Request Options for Fare_MasterPricerTravelboardSearch
*
* @package Amadeus\Client\RequestOptions
* @author Dieter Devlieghere <dermikagh@gmail.com>
*/
class FareMasterPricerExSearch extends MpBaseOptions
{
const FLIGHTTYPE_DIRECT = "D";
const FLIGHTTYPE_NONSTOP = "N";
const FLIGHTTYPE_CONNECTING = "C";

const CABIN_ECONOMY = "Y";
const CABIN_ECONOMY_STANDARD = "M";
const CABIN_ECONOMY_PREMIUM = "W";
const CABIN_BUSINESS = "C";
const CABIN_FIRST_SUPERSONIC = "F";

const AIRLINEOPT_PREFERRED = "F";
const AIRLINEOPT_MANDATORY = "M";
const AIRLINEOPT_NIGHT_CLASS = "N";
const AIRLINEOPT_FORCE_FULLAIRLINE_RECOMMENDATION = "O";
const AIRLINEOPT_CARRIERS_LIST_BYPASS_BSP_CHECKS = "T";
const AIRLINEOPT_MANDATORY_VALIDATING_CARRIER = "V";
const AIRLINEOPT_EXCLUDED_VALIDATING_CARRIER = "W";
const AIRLINEOPT_EXCLUDED = "X";

/**
* Major cabin
*/
const CABINOPT_MAJOR = "MC";
/**
* Mandatory cabin for all segments
*/
const CABINOPT_MANDATORY = "MD";
/**
* Recommended cabin to be used at least one segment
*/
const CABINOPT_RECOMMENDED = "RC";

/**
* List of airline options.
*
* Keys are the option to be used (self::AIRLINEOPT_*), values are the airline codes:
*
* e.g.
* 'airlineOptions' => [
* self::AIRLINEOPT_PREFERRED => [
* 'LH',
* 'BA'
* ]
* ]
*
* @var array
*/
public $airlineOptions = [];

/**
* Itinerary-level flight options
*
* Choose from self::FLIGHTTYPE_*
*
* @var string[]
*/
public $requestedFlightTypes = [];

/**
* Cabin class requested for the entire itinerary
*
* self::CABIN_*
*
* @var string
*/
public $cabinClass;

/**
* Cabin option - how to interpret the cabin class
*
* self::CABINOPT_*
*
* @var string
*/
public $cabinOption;

/**
* Requested flight itinerary
*
* @var Fare\MPItinerary[]
*/
public $itinerary = [];

/**
* The maximum price to be returned in the recommendations
*
* @var int|null
*/
public $priceToBeat;

/**
* Currency of the maximum price to beat
*
* @var string|null
*/
public $priceToBeatCurrency;

/**
* Fare Families
*
* @var Fare\MPFareFamily[]
*/
public $fareFamilies = [];

/**
* Office IDs
*
* @var string[]
*/
public $officeIds = [];

/**
* Progressive legs enables to request a range of number of connections
* relative to the minimum connections that exist on Journey Server.
*
* Enter the minimum amount of allowed progressive legs here.
*
* @var int
*/
public $progressiveLegsMin;

/**
* Progressive legs enables to request a range of number of connections
* relative to the minimum connections that exist on Journey Server.
*
* Enter the maximum amount of allowed progressive legs here.
*
* @var int
*/
public $progressiveLegsMax;

/**
* "DK" number / customer identification number
*
* @var string
*/
public $dkNumber;

/**
* Each connection of each requested segment has a layover limited to X hours.
*
* @var int
*/
public $maxLayoverPerConnectionHours;

/**
* Each connection of each requested segment has a layover limited to Y minutes.
*
* @var int
*/
public $maxLayoverPerConnectionMinutes;

/**
* @var Fare\MPFeeOption[]
*/
public $feeOption = [];
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?php
/**
* amadeus-ws-client
*
* Copyright 2015 Amadeus Benelux NV
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @package Amadeus
* @license https://opensource.org/licenses/Apache-2.0 Apache 2.0
*/

namespace Amadeus\Client\ResponseHandler\Fare;

use Amadeus\Client\ResponseHandler\StandardResponseHandler;
use Amadeus\Client\Result;
use Amadeus\Client\Session\Handler\SendResult;

/**
* HandlerMasterPricerExpertSearch
*
* @package Amadeus\Client\ResponseHandler\Fare
* @author Dieter Devlieghere <dermikagh@gmail.com>
*/
class HandlerMasterPricerExpertSearch extends StandardResponseHandler
{
/**
* @param SendResult $response
* @return Result
*/
public function analyze(SendResult $response)
{
$analyzeResponse = new Result($response);

$domXpath = $this->makeDomXpath($response->responseXml);

$queryErrCode = "//m:applicationError//m:applicationErrorDetail/m:error";
$queryErrMsg = "//m:errorMessageText/m:description";

$codeNode = $domXpath->query($queryErrCode)->item(0);

if ($codeNode instanceof \DOMNode) {
$analyzeResponse->status = Result::STATUS_ERROR;

$errMsg = '';
$errMsgNode = $domXpath->query($queryErrMsg)->item(0);
if ($errMsgNode instanceof \DOMNode) {
$errMsg = $errMsgNode->nodeValue;
}

$analyzeResponse->messages[] = new Result\NotOk(
$codeNode->nodeValue,
$errMsg
);
}

return $analyzeResponse;
}
}
Loading

0 comments on commit 54fc202

Please sign in to comment.