-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
570 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/Amadeus/Client/RequestCreator/Converter/Fare/MasterPricerExpertSearchConv.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
189
src/Amadeus/Client/RequestOptions/FareMasterPricerExSearch.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = []; | ||
} |
69 changes: 69 additions & 0 deletions
69
src/Amadeus/Client/ResponseHandler/Fare/HandlerMasterPricerExpertSearch.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
Oops, something went wrong.