Skip to content

Commit

Permalink
Merge d006266 into b072260
Browse files Browse the repository at this point in the history
  • Loading branch information
bimusiek committed Dec 19, 2019
2 parents b072260 + d006266 commit ce08479
Show file tree
Hide file tree
Showing 25 changed files with 1,049 additions and 9 deletions.
47 changes: 47 additions & 0 deletions docs/samples/masterpricertravelboard.rst
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,53 @@ Brussels - London with preferred airlines BA or SN:
$message = new MasterPricerTravelBoardSearch($opt);
Anchored segments
==================

Brussels - London with anchored segment:

.. code-block:: php
use Amadeus\Client\RequestOptions\FareMasterPricerTbSearch;
use Amadeus\Client\RequestOptions\Fare\MPItinerary;
use Amadeus\Client\RequestOptions\Fare\MPLocation;
use Amadeus\Client\RequestOptions\Fare\MPPassenger;
use Amadeus\Client\RequestOptions\Fare\MPDate;
use Amadeus\Client\RequestOptions\Fare\MPAnchoredSegment;
$opt = new FareMasterPricerTbSearch([
'nrOfRequestedResults' => 30,
'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-15T14:00:00+0000', new \DateTimeZone('UTC'))
])
])
],
'anchoredSegments' => [
new MPAnchoredSegment([
'departureDate' => \DateTime::createFromFormat('Ymd Hi','20180315 1540', new \DateTimeZone('UTC')),
'arrivalDate' => \DateTime::createFromFormat('Ymd Hi','20180316 0010', new \DateTimeZone('UTC')),
'dateVariation' => '',
'from' => 'BRU',
'to' => 'LHR',
'companyCode' => 'BA',
'flightNumber' => '20'
])
]
]);
$message = new MasterPricerTravelBoardSearch($opt);
Multi-city & airline exclusion
==============================
Expand Down
19 changes: 19 additions & 0 deletions src/Amadeus/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -1584,6 +1584,25 @@ public function serviceIntegratedCatalogue(
return $this->callMessage($msgName, $options, $messageOptions);
}

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

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

/**
* SalesReports_DisplayorSummarizedReport
*
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\Service;

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

/**
* Service_BookPriceService Request converter
*
* @package Amadeus\Client\RequestCreator\Converter\Service
* @author Mike Hernas <mike@ahoy.io>
*/
class BookPriceServiceConv extends BaseConverter
{
/**
* @param ServiceBookPriceServiceOptions $requestOptions
* @param int|string $version
* @return Struct\Service\BookPriceService
*/
public function convert($requestOptions, $version)
{
return new Struct\Service\BookPriceService($requestOptions);
}
}
35 changes: 35 additions & 0 deletions src/Amadeus/Client/RequestOptions/Fare/MPAnchoredSegment.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?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\Fare;

use Amadeus\Client\RequestOptions\Air\SellFromRecommendation\Segment as SegmentOptions;

/**
* MPAnchoredSegment request options.
*
* @package Amadeus\Client\RequestOptions\Fare
* @author Mike Hernas <mike@ahoy.io>
*/
class MPAnchoredSegment extends SegmentOptions
{
}
9 changes: 9 additions & 0 deletions src/Amadeus/Client/RequestOptions/Fare/MPItinerary.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,13 @@ class MPItinerary extends LoadParamsFromArray
* @var string
*/
public $cabinOption;

public $travelDetails;

/**
* Anchored Search segment (MPAnchoredSegment)
*
* @var array[MPAnchoredSegment]
*/
public $anchoredSegments;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?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\Service\BookPriceService;

use Amadeus\Client\LoadParamsFromArray;

/**
* Identifier
*
* @package Amadeus\Client\RequestOptions\Service\BookPriceService
* @author Mike Hernas <mike@ahoy.io>
*/
class Identifier extends LoadParamsFromArray
{
const BOOKING_METHOD_SSR = 1;
const BOOKING_METHOD_SVC = 2;

/**
* self::BOOKING_METHOD_*
*
* 01 SSR type of booking method
* 02 SVC type of booking method
*
* @var string
*/
public $bookingMethod;

/**
*
* @var string
*/
public $RFIC;

/**
*
* @var string
*/
public $RFISC;

/**
*
* @var string
*/
public $code;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?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;

use Amadeus\Client\RequestOptions\Service\BookPriceService\Identifier;

/**
* Service_BookPriceService Request Options
*
* @package Amadeus\Client\RequestOptions
* @author Mike Hernas <mike@ahoy.io>
*/
class ServiceBookPriceServiceOptions extends Base
{

/**
* Booking carrier of the service
*
* @var string
*/
public $serviceProvider;

/**
*
* @var Identifier
*/
public $identifier;

/**
* Request ID
* @var string
*/
public $TID;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?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\Service;

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

/**
* HandlerBookPriceService
*
* @package Amadeus\Client\ResponseHandler\Service
* @author Mike Hernas <m@hern.as>
*/
class HandlerBookPriceService extends StandardResponseHandler
{
/**
* @param SendResult $response
* @return Result
*/
public function analyze(SendResult $response)
{
$analyzeResponse = new Result($response);
$domXpath = $this->makeDomXpath($response->responseXml);

$errorCodeNodeList = $domXpath->query("//ama:Error");

if ($errorCodeNodeList->length > 0) {
$analyzeResponse->status = Result::STATUS_ERROR;

foreach (iterator_to_array($errorCodeNodeList) as $msg) {
$analyzeResponse->messages[] = new Result\NotOk(
$msg->getAttribute('Code'),
trim($msg->getAttribute('ShortText'))
);
}

return $analyzeResponse;
}

$success = $domXpath->query('//m:Success');
if ($success->length > 0) {
$analyzeResponse->status = Result::STATUS_OK;
return $analyzeResponse;
}

$analyzeResponse->status = Result::STATUS_UNKNOWN;
return $analyzeResponse;
}
}
6 changes: 4 additions & 2 deletions src/Amadeus/Client/Struct/Air/FlightDate.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
*/
class FlightDate
{
protected $dateFormat = 'dmy';

/**
* DDMMYY
*
Expand Down Expand Up @@ -84,7 +86,7 @@ public function __construct($departureDate, $arrivalDate = null, $arrivalTime =
protected function loadDepartureDate($departureDate)
{
if ($departureDate instanceof \DateTime) {
$this->departureDate = ($departureDate->format('dmy') !== '000000') ? $departureDate->format('dmy') : null;
$this->departureDate = ($departureDate->format('dmy') !== '000000') ? $departureDate->format($this->dateFormat) : null;
$time = $departureDate->format('Hi');
if ($time !== '0000') {
$this->departureTime = $time;
Expand Down Expand Up @@ -119,7 +121,7 @@ protected function loadArrivalDate($arrivalDate, $arrivalTime)
*/
public function setArrivalDate(\DateTime $arrivalDate)
{
$this->arrivalDate = ($arrivalDate->format('dmy') !== '000000') ? $arrivalDate->format('dmy') : null;
$this->arrivalDate = ($arrivalDate->format('dmy') !== '000000') ? $arrivalDate->format($this->dateFormat) : null;
$time = $arrivalDate->format('Hi');
if ($time !== '0000') {
$this->arrivalTime = $time;
Expand Down
Loading

0 comments on commit ce08479

Please sign in to comment.