Skip to content

Commit

Permalink
Implemented PriceXplorer_ExtremeSearch extra unittests on MasterPrice…
Browse files Browse the repository at this point in the history
…rTravelBoardSearch
  • Loading branch information
DerMika committed Feb 27, 2016
1 parent ca13b78 commit 8d7a3cf
Show file tree
Hide file tree
Showing 37 changed files with 2,356 additions and 3 deletions.
3 changes: 2 additions & 1 deletion docs/about-get-started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ This is the list of messages that are at least partially supported at this time:
- MiniRule_GetFromPricingRec
- Ticket_CreateTSTFromPricing
- Command_Cryptic
- PriceXplorer_ExtremeSearch


We plan to support an entire basic booking flow (MasterPricer, SellFromRecommendation, Pricing, ...) later on.

Expand All @@ -128,7 +130,6 @@ On the to-do list / work in progress:
- Fare_CalculateMileage
- Info_EncodeDecodeCity
- Offer_ConfirmHotelOffer
- PriceXplorer_ExtremeSearch
- PointOfRef_Search
- Ticket_DisplayTST

21 changes: 21 additions & 0 deletions docs/samples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -536,3 +536,24 @@ Send any cryptic Amadeus Selling Platform entry which does not have a structured
$crypticResponse = $client->commandCryptic($opt);
**************************
PriceXplorer_ExtremeSearch
**************************

Request a basic Extreme Search result:

.. code-block:: php
use Amadeus\Client\RequestOptions\PriceXplorerExtremeSearchOptions;
$opt = new PriceXplorerExtremeSearchOptions([
'resultAggregationOption' => PriceXplorerExtremeSearchOptions::AGGR_COUNTRY,
'origin' => 'BRU',
'destinations' => ['SYD', 'CBR'],
'earliestDepartureDate' => \DateTime::createFromFormat('Y-m-d','2016-08-25', new \DateTimeZone('UTC')),
'latestDepartureDate' => \DateTime::createFromFormat('Y-m-d','2016-09-28', new \DateTimeZone('UTC')),
'searchOffice' => 'LONBG2222'
]);
$extremeSearchResult = $client->priceXplorerExtremeSearch($opt);
22 changes: 22 additions & 0 deletions src/Amadeus/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,28 @@ public function ticketCreateTSTFromPricing(RequestOptions\TicketCreateTstFromPri
);
}

/**
* PriceXplorer_ExtremeSearch
*
* @param RequestOptions\PriceXplorerExtremeSearchOptions $options
* @param array $messageOptions
* @return mixed
*/
public function priceXplorerExtremeSearch(RequestOptions\PriceXplorerExtremeSearchOptions $options, $messageOptions = [])
{
$msgName = 'PriceXplorer_ExtremeSearch';
$messageOptions = $this->makeMessageOptions($messageOptions);

return $this->sessionHandler->sendMessage(
$msgName,
$this->requestCreator->createRequest(
$msgName,
$options
),
$messageOptions
);
}

/**
* Make message options
*
Expand Down
11 changes: 11 additions & 0 deletions src/Amadeus/Client/RequestCreator/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
use Amadeus\Client\RequestOptions\PnrCreatePnrOptions;
use Amadeus\Client\RequestOptions\PnrRetrieveAndDisplayOptions;
use Amadeus\Client\RequestOptions\PnrRetrieveOptions;
use Amadeus\Client\RequestOptions\PriceXplorerExtremeSearchOptions;
use Amadeus\Client\RequestOptions\QueueListOptions;
use Amadeus\Client\RequestOptions\QueueMoveItemOptions;
use Amadeus\Client\RequestOptions\QueuePlacePnrOptions;
Expand Down Expand Up @@ -352,6 +353,16 @@ protected function createTicketCreateTSTFromPricing(TicketCreateTstFromPricingOp
return new Struct\Ticket\CreateTSTFromPricing($params);
}

/**
* @param PriceXplorerExtremeSearchOptions $params
*
* @return Struct\PriceXplorer\ExtremeSearch
*/
protected function createPriceXplorerExtremeSearch(PriceXplorerExtremeSearchOptions $params)
{
return new Struct\PriceXplorer\ExtremeSearch($params);
}

/**
* Check if a given message is in the active WSDL. Throws exception if it isn't.
*
Expand Down
172 changes: 172 additions & 0 deletions src/Amadeus/Client/RequestOptions/PriceXplorerExtremeSearchOptions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
<?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;

/**
* PriceXplorerExtremeSearchOptions
*
* @package Amadeus\Client\RequestOptions
* @author Dieter Devlieghere <dieter.devlieghere@benelux.amadeus.com>
*/
class PriceXplorerExtremeSearchOptions extends Base
{
const CURRENCY_EURO = "EUR";

const AGGR_DEST = 'D';

const AGGR_DEST_WEEK = 'DW';

const AGGR_DEST_WEEK_DEPART = 'DWDP';

const AGGR_DEST_WEEK_DEPART_STAY = 'DWDPS';

const AGGR_COUNTRY = 'C';

/**
* Departure location - airport or city code
*
* @var string
*/
public $origin;

/**
* Destination locations - array of airport or city codes
*
* @var array
*/
public $destinations = [];

/**
* Destination countries - array of country codes
*
* @var array
*/
public $destinationCountries = [];

/**
* Currency for max/min budget options
*
* @var string
*/
public $currency;

/**
* Maximum budget, expressed in $this->currency currency.
*
* @var int
*/
public $maxBudget;

/**
* Minimum budget, expressed in $this->currency currency.
*
* @var int
*/
public $minBudget;

/**
* Earliest possible departure date.
*
* @var \DateTime
*/
public $earliestDepartureDate;

/**
* Latest possible departure date.
*
* @var \DateTime
*/
public $latestDepartureDate;

/**
* (Consecutive) departure days of week for outbound flight
*
* 1: Monday
* 2: Tuesday
* 3: Wednesday
* 4: Thursday
* 5: Friday
* 6: Saturday
* 7: Sunday
*
* @var array
*/
public $departureDaysOutbound = [];

/**
* (Consecutive) departure days of week for inbound flight
*
* 1: Monday
* 2: Tuesday
* 3: Wednesday
* 4: Thursday
* 5: Friday
* 6: Saturday
* 7: Sunday
*
* @var array
*/
public $departureDaysInbound = [];

/**
* Stay Duration in days
*
* @var int
*/
public $stayDurationDays;

/**
* Flexibility of Stay Duration in days
*
* @var int
*/
public $stayDurationFlexibilityDays;

/**
* Set to True to return cheapest overall price
*
* @var boolean
*/
public $returnCheapestOverall = false;

/**
* Set to True to return cheapest nonstop price
*
* @var boolean
*/
public $returnCheapestNonStop = false;

/**
* Price result aggregation option - use one of the self::AGGR_* constants
*
* @var string
*/
public $resultAggregationOption;

/**
* Which Office ID to use when finding prices
*
* @var string Amadeus Office ID
*/
public $searchOffice;
}
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ protected function loadPassenger($passenger, &$counter, &$infantCounter)
{
$isInfant = ($passenger->type === 'INF');

$this->paxReference = new MasterPricer\PaxReference(
$paxRef = new MasterPricer\PaxReference(
$isInfant ? $infantCounter : $counter,
$isInfant,
$passenger->type
Expand All @@ -189,7 +189,7 @@ protected function loadPassenger($passenger, &$counter, &$infantCounter)

if ($passenger->count > 1) {
for ($i = 2; $i <= $passenger->count; $i++) {
$this->paxReference->traveller[] = new MasterPricer\Traveller($counter);
$paxRef->traveller[] = new MasterPricer\Traveller($counter);

if ($isInfant) {
$infantCounter++;
Expand All @@ -198,6 +198,8 @@ protected function loadPassenger($passenger, &$counter, &$infantCounter)
}
}
}

$this->paxReference[] = $paxRef;
}

/**
Expand Down
42 changes: 42 additions & 0 deletions src/Amadeus/Client/Struct/PriceXplorer/AirlineInfo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?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\Struct\PriceXplorer;

/**
* Structure class for the AirlineInfo message part for PriceXplorer_* messages
*
* @package Amadeus\Client\Struct\PriceXplorer
* @author Dieter Devlieghere <dieter.devlieghere@benelux.amadeus.com>
*/
class AirlineInfo
{
/**
* @var mixed
*/
public $attributeInfo;

/**
* @var mixed
*/
public $airlineDetails;
}
Loading

0 comments on commit 8d7a3cf

Please sign in to comment.