Skip to content

Commit

Permalink
MastePricerTravelboardSearch
Browse files Browse the repository at this point in the history
  • Loading branch information
DerMika committed Feb 8, 2016
1 parent 082151f commit d383365
Show file tree
Hide file tree
Showing 12 changed files with 350 additions and 35 deletions.
10 changes: 10 additions & 0 deletions src/Amadeus/Client/RequestCreator/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
namespace Amadeus\Client\RequestCreator;

use Amadeus\Client\Params\RequestCreatorParams;
use Amadeus\Client\RequestOptions\FareMasterPricerTbSearch;
use Amadeus\Client\RequestOptions\OfferConfirmAirOptions;
use Amadeus\Client\RequestOptions\OfferConfirmCarOptions;
use Amadeus\Client\RequestOptions\OfferConfirmHotelOptions;
Expand Down Expand Up @@ -249,6 +250,15 @@ protected function createOfferConfirmCar(OfferConfirmCarOptions $params)
return $req;
}

/**
* @param FareMasterPricerTbSearch $params
* @return Struct\Fare\MasterPricerTravelBoardSearch
*/
protected function createFareMasterPricerTravelBoardSearch(FareMasterPricerTbSearch $params)
{
return new Struct\Fare\MasterPricerTravelBoardSearch($params);
}

/**
* @param PnrCreatePnrOptions $params
* @return Struct\Pnr\AddMultiElements
Expand Down
4 changes: 2 additions & 2 deletions src/Amadeus/Client/RequestOptions/Fare/MPDate.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ class MPDate extends LoadParamsFromArray
/**
* Departure or arrival date
*
* We only use the date portion
* We only use the date portion!
*
* @var \DateTime
*/
public $date;
/**
* Departure or arrival time
*
* We only use the date portion
* We only use the time portion!
*
* @var \DateTime
*/
Expand Down
18 changes: 0 additions & 18 deletions src/Amadeus/Client/RequestOptions/FareMasterPricerTbSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,24 +82,6 @@ class FareMasterPricerTbSearch extends Base
/**
* Requested flight itinerary
*
* e.g. 2 segments: BRU-MAD, MAD-BRU
* array(
* 1 =>
* array(
* 'from' => 'BRU'
* 'to' => 'MAD'
* 'date' => '280511'
* 'time' => '1000'
* ),
* 2 =>
* array(
* 'from' => 'MAD'
* 'to' => 'BRU'
* 'date' => '030611'
* 'time' => '1800'
* )
* );
*
* @var Fare\MPItinerary[]
*/
public $itinerary = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

namespace Amadeus\Client\Struct\Fare\MasterPricer;

use Amadeus\Client\RequestOptions\Fare\MPLocation;

/**
* ArrivalLocalization
*
Expand All @@ -42,4 +44,13 @@ class ArrivalLocalization
* @var AttributeDetails[]
*/
public $attributeDetails = [];

/**
* ArrivalLocalization constructor.
* @param MPLocation $location
*/
public function __construct(MPLocation $location)
{
$this->arrivalPointDetails = new LocationDetails($location);
}
}
63 changes: 63 additions & 0 deletions src/Amadeus/Client/Struct/Fare/MasterPricer/CabinId.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?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\Fare\MasterPricer;

/**
* CabinId
*
* @package Amadeus\Client\Struct\Fare\MasterPricer
*/
class CabinId
{
const CABIN_ECONOMY = "Y";
const CABIN_ECONOMY_STANDARD = "M";
const CABIN_ECONOMY_PREMIUM = "W";
const CABIN_BUSINESS = "C";
const CABIN_FIRST_SUPERSONIC = "F";

/**
* MC Major cabin
* MD Mandatory cabin for all segments
* RC Recommended cabin to be used at least one segment
*
* @var string
*/
public $cabinQualifier;

/**
* self::CABIN_*
*
* @var string
*/
public $cabin;

/**
* CabinId constructor.
*
* @param string $cabinCode self::CABIN_*
*/
public function __construct($cabinCode)
{
$this->cabin = $cabinCode;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

namespace Amadeus\Client\Struct\Fare\MasterPricer;

use Amadeus\Client\RequestOptions\Fare\MPLocation;

/**
* DepartureLocalization
*
Expand Down Expand Up @@ -54,4 +56,14 @@ class DepartureLocalization
* @var AttributeDetails[]
*/
public $attributeDetails = [];

/**
* DepartureLocalization constructor.
*
* @param MPLocation $location
*/
public function __construct(MPLocation $location)
{
$this->departurePoint = new LocationDetails($location);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,14 @@ class FirstDateTimeDetail
* @var int
*/
public $timeWindow;

/**
* FirstDateTimeDetail constructor.
*
* @param string $date DDMMYY
*/
public function __construct($date)
{
$this->date = $date;
}
}
28 changes: 28 additions & 0 deletions src/Amadeus/Client/Struct/Fare/MasterPricer/LocationDetails.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

namespace Amadeus\Client\Struct\Fare\MasterPricer;

use Amadeus\Client\RequestOptions\Fare\MPLocation;

/**
* LocationDetails
*
Expand Down Expand Up @@ -73,4 +75,30 @@ class LocationDetails
* @var string
*/
public $longitude;

/**
* LocationDetails constructor.
*
* @param MPLocation $location
*/
public function __construct(MPLocation $location)
{
if (!empty($location->airport)) {
$this->locationId = $location->airport;
$this->airportCityQualifier = "A";
} elseif (!empty(($location->city))) {
$this->locationId = $location->city;
$this->airportCityQualifier = "C";
}

if (!empty($location->longitude) && !empty($location->latitude)) {
$this->longitude = $location->longitude;
$this->latitude = $location->latitude;
}

if (!empty($location->radiusDistance) && !empty($location->radiusUnit)) {
$this->distance = $location->radiusDistance;
$this->distanceUnit = $location->radiusUnit;
}
}
}
17 changes: 14 additions & 3 deletions src/Amadeus/Client/Struct/Fare/MasterPricer/TimeDetails.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

namespace Amadeus\Client\Struct\Fare\MasterPricer;

use Amadeus\Client\RequestOptions\Fare\MPDate;

/**
* TimeDetails
*
Expand All @@ -44,10 +46,19 @@ class TimeDetails
public $tripDetails;

/**
* @return void
* TimeDetails constructor.
*
* @param MPDate $theDate
*/
public function __construct()
public function __construct(MPDate $theDate)
{
$this->firstDateTimeDetail = new FirstDateTimeDetail();
$this->firstDateTimeDetail = new FirstDateTimeDetail($theDate->date->format('dmy'));

if ($theDate->time instanceof \DateTime) {
$this->firstDateTimeDetail->time = $theDate->time->format('Hi');
}
if (is_int($theDate->timeWindow)) {
$this->firstDateTimeDetail->timeWindow = $theDate->timeWindow;
}
}
}
58 changes: 58 additions & 0 deletions src/Amadeus/Client/Struct/Fare/MasterPricer/TravelFlightInfo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?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\Fare\MasterPricer;

/**
* TravelFlightInfo
*
* @package Amadeus\Client\Struct\Fare\MasterPricer
*/
class TravelFlightInfo
{
/**
* @var CabinId
*/
public $cabinId;

public $companyIdentity = [];

public $flightDetail;

public $inclusionDetail = [];

public $exclusionDetail = [];

public $unitNumberDetail = [];

/**
* TravelFlightInfo constructor.
*
* @param string|null $cabinCode
*/
public function __construct($cabinCode = null)
{
if (!is_null($cabinCode)) {
$this->cabinId = new CabinId($cabinCode);
}
}
}
Loading

0 comments on commit d383365

Please sign in to comment.