Skip to content

Commit

Permalink
Implement new message Fare_MasterPricerExpertSearch (#170)
Browse files Browse the repository at this point in the history
  • Loading branch information
m0veax authored and DerMika committed May 25, 2019
1 parent af83906 commit b20918e
Show file tree
Hide file tree
Showing 15 changed files with 2,433 additions and 164 deletions.
1 change: 1 addition & 0 deletions docs/list-of-supported-messages.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ This is the list of messages that are at least partially supported at this time:
- Queue_RemoveItem
- Queue_MoveItem
- Fare_MasterPricerTravelBoardSearch
- Fare_MasterPricerExpertSearch
- Fare_MasterPricerCalendar
- Fare_PricePNRWithBookingClass
- Fare_PricePNRWithLowerFares
Expand Down
45 changes: 44 additions & 1 deletion docs/samples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -695,11 +695,54 @@ Move a PNR from one queue to another:
****
Fare
****

----------------------------------
Fare_MasterPricerExpertSearch
----------------------------------

The Expert Search is nearly identical to the Travelboard search, except it focus on business flights.

It supports all features of the Travelboard Search, but not the options "noAirportChange" and "maxElapsedFlyingTime"

Make a simple Masterpricer Expert availability & fare search:

.. code-block:: php
use Amadeus\Client\RequestOptions\FareMasterPricerExSearch;
use Amadeus\Client\RequestOptions\Fare\MPPassenger;
use Amadeus\Client\RequestOptions\Fare\MPItinerary;
use Amadeus\Client\RequestOptions\Fare\MPDate;
use Amadeus\Client\RequestOptions\Fare\MPLocation;
$opt = new FareMasterPricerExSearch([
'nrOfRequestedResults' => 200,
'nrOfRequestedPassengers' => 1,
'passengers' => [
new MPPassenger([
'type' => MPPassenger::TYPE_ADULT,
'count' => 1
])
],
'itinerary' => [
new MPItinerary([
'departureLocation' => new MPLocation(['city' => 'BRU']),
'arrivalLocation' => new MPLocation(['city' => 'LON']),
'date' => new MPDate([
'dateTime' => new \DateTime('2017-01-15T00:00:00+0000', new \DateTimeZone('UTC'))
])
])
]
]);
$recommendations = $client->fareMasterPricerExpertSearch($opt);
Since the Expert Search is nearly similar to the Travelboard Search, check out the Travelboard Search examples too

----------------------------------
Fare_MasterPricerTravelboardSearch
----------------------------------

Make a simple Masterpricer availability & fare search:
Make a simple Masterpricer Travelboard availability & fare search:

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

/**
* Fare_MasterPricerExpertSearch
*
* @param RequestOptions\FareMasterPricerExSearchOptions $options
* @param array $messageOptions (OPTIONAL)
* @return Result
* @throws Client\InvalidMessageException
* @throws Client\RequestCreator\MessageVersionUnsupportedException
* @throws Exception
*/
public function fareMasterPricerExpertSearch(
RequestOptions\FareMasterPricerExSearchOptions $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\FareMasterPricerExSearchOptions;
use Amadeus\Client\Struct;

/**
* Fare_MasterPricerExpertSearch Request converter
*
* @package Amadeus\Client\RequestCreator\Converter\Fare
* @author Dieter Devlieghere <[email protected]>
*/
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);
}
}
191 changes: 191 additions & 0 deletions src/Amadeus/Client/RequestOptions/FareMasterPricerExSearchOptions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
<?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 <[email protected]>
*/
class FareMasterPricerExSearchOptions 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;

/**
* Fee Options
*
* @var Fare\MPFeeOption[]
*/
public $feeOption = [];
}
Loading

0 comments on commit b20918e

Please sign in to comment.