Skip to content

Commit

Permalink
Issue #219 Retrieve with recordlocator, CompanyId, date, most restric…
Browse files Browse the repository at this point in the history
…tive (#221)

Fix for #219 along with a few extra options.
  • Loading branch information
DerMika authored Aug 5, 2018
1 parent a8d3424 commit fec48d8
Show file tree
Hide file tree
Showing 9 changed files with 206 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
* Added support for Ticketing Price Scheme option in ``Fare_MasterPricerTravelBoardSearch`` (https://github.com/amabnl/amadeus-ws-client/pull/193) - Artem Zakharchenko
* Added support for cabin options on itinerary-level in ``Fare_MasterPricerTravelBoardSearch`` (https://github.com/amabnl/amadeus-ws-client/pull/202) - Michal Hernas
* Added support for OptionDetails when proving pricing options overrides in ``Fare_PricePNRWithBookingClass`` (v13+) and associated messages (https://github.com/amabnl/amadeus-ws-client/pull/217) - LeoTravel
* Added support for providing a Company and date in combination with a Record Locator in ``Air_RetrieveSeatMap`` (https://github.com/amabnl/amadeus-ws-client/issues/219)
* Added support for requesting Most Restrictive display ``Air_RetrieveSeatMap``
* Implemented ``Ticket_RetrieveListOfTSM`` (https://github.com/amabnl/amadeus-ws-client/pull/194) - Michal Hernas
* Implemented ``Ticket_CreateTASF`` (https://github.com/amabnl/amadeus-ws-client/pull/197) - Artem Zakharchenko
* Implemented ``PNR_Ignore`` (https://github.com/amabnl/amadeus-ws-client/pull/198) - Michael Mueller
Expand Down
27 changes: 27 additions & 0 deletions docs/samples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1536,6 +1536,33 @@ Complex example: Seat Map with Prices
])
);
Most restrictive Seat Map request:

- Multiple passenger context
- Requesting the most restrictive seat map display

.. code-block:: php
use Amadeus\Client\RequestOptions\AirRetrieveSeatMapOptions;
use Amadeus\Client\RequestOptions\Air\RetrieveSeatMap\FlightInfo;
$seatmapInfo = $client->airRetrieveSeatMap(
new AirRetrieveSeatMapOptions([
'flight' => new FlightInfo([
'departureDate' => \DateTime::createFromFormat('Ymd', '20150615'),
'departure' => 'CDG',
'arrival' => 'YUL',
'airline' => 'AF',
'flightNumber' => '0346',
'bookingClass' => 'Y'
]),
'recordLocator' => '7BFHEJ',
'company' => '1A',
'date' => \DateTime::createFromFormat('Ymd', '20150610'),
'mostRestrictive' => true
])
);
--------------------
Air_RebookAirSegment
--------------------
Expand Down
21 changes: 21 additions & 0 deletions src/Amadeus/Client/RequestOptions/AirRetrieveSeatMapOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,20 @@ class AirRetrieveSeatMapOptions extends Base
*/
public $recordLocator;

/**
* Airline code - to be provided in combination with Record Locator
*
* @var string
*/
public $company;

/**
* Date (and optionally time) - to be provided in combination with Record Locator
*
* @var \DateTime
*/
public $date;

/**
* Number of passengers
*
Expand All @@ -99,4 +113,11 @@ class AirRetrieveSeatMapOptions extends Base
* @var string
*/
public $bookingStatus;

/**
* Set to true to request the most restrictive seat map display
*
* @var bool
*/
public $mostRestrictive = false;
}
15 changes: 14 additions & 1 deletion src/Amadeus/Client/Struct/Air/RetrieveSeatMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
use Amadeus\Client\RequestOptions\AirRetrieveSeatMapOptions;
use Amadeus\Client\Struct\Air\RetrieveSeatMap\ConversionRate;
use Amadeus\Client\Struct\Air\RetrieveSeatMap\FrequentTravelerInfo;
use Amadeus\Client\Struct\Air\RetrieveSeatMap\ProcessIndicators;
use Amadeus\Client\Struct\Air\RetrieveSeatMap\ProductInformation;
use Amadeus\Client\Struct\Air\RetrieveSeatMap\ResControlInfo;
use Amadeus\Client\Struct\Air\RetrieveSeatMap\SeatRequestParameters;
use Amadeus\Client\Struct\Air\RetrieveSeatMap\StatusInformation;
use Amadeus\Client\Struct\Air\RetrieveSeatMap\Traveller;
use Amadeus\Client\Struct\Air\RetrieveSeatMap\TravelProductIdent;
use Amadeus\Client\Struct\BaseWsMessage;
Expand Down Expand Up @@ -68,6 +70,9 @@ class RetrieveSeatMap extends BaseWsMessage

public $suitablePassenger;

/**
* @var ProcessIndicators
*/
public $processIndicators;


Expand Down Expand Up @@ -96,6 +101,10 @@ public function __construct(AirRetrieveSeatMapOptions $options)
$this->loadProductInformation($options);

$this->loadPassengers($options);

if ($options->mostRestrictive) {
$this->processIndicators = new ProcessIndicators(StatusInformation::ACTION_MOST_RESTRICTIVE);
}
}

/**
Expand All @@ -117,7 +126,11 @@ protected function loadSeatRequestParameters($options)
protected function loadRecordLocator($options)
{
if (!empty($options->recordLocator)) {
$this->resControlInfo = new ResControlInfo($options->recordLocator);
$this->resControlInfo = new ResControlInfo(
$options->recordLocator,
$options->company,
$options->date
);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?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\Air\RetrieveSeatMap;

/**
* ProcessIndicators
*
* @package Amadeus\Client\Struct\Air\RetrieveSeatMap
* @author Dieter Devlieghere <[email protected]>
*/
class ProcessIndicators
{
/**
* @var StatusInformation[]
*/
public $statusInformation = [];

/**
* ProcessIndicators constructor.
*
* @param string $action
*/
public function __construct($action)
{
$this->statusInformation[] = new StatusInformation($action);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ class ResControlInfo
* ResControlInfo constructor.
*
* @param string $recordLocator
* @param string $companyId
* @param \DateTime|null $date
*/
public function __construct($recordLocator)
public function __construct($recordLocator, $companyId, $date = null)
{
$this->reservation = new Reservation($recordLocator);
$this->reservation = new Reservation($recordLocator, $companyId, $date);
}
}
14 changes: 13 additions & 1 deletion src/Amadeus/Client/Struct/Air/RetrieveSeatMap/Reservation.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,21 @@ class Reservation
* Reservation constructor.
*
* @param string $controlNumber
* @param string $companyId
* @param \DateTime|null $date
*/
public function __construct($controlNumber)
public function __construct($controlNumber, $companyId, $date = null)
{
$this->controlNumber = $controlNumber;
$this->companyId = $companyId;

if ($date instanceof \DateTime) {
$this->date = $date->format('dmy');
$timeString = $date->format('Hi');

if ($timeString !== '0000') {
$this->time = $timeString;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?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\Air\RetrieveSeatMap;

/**
* StatusInformation
*
* @package Amadeus\Client\Struct\Air\RetrieveSeatMap
* @author Dieter Devlieghere <[email protected]>
*/
class StatusInformation
{
const ACTION_MOST_RESTRICTIVE = 'MRE';
const ACTION_NEUTRAL_SEAT_MAP = 'NSM';

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

/**
* StatusInformation constructor.
*
* @param string $action
*/
public function __construct($action)
{
$this->action = $action;
}
}
28 changes: 28 additions & 0 deletions tests/Amadeus/Client/Struct/Air/RetrieveSeatMapTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,4 +297,32 @@ public function testCanMakeRequestWithCabinClass()
$this->assertNull($message->seatRequestParameters->genericDetails->noSmokingIndicator);
$this->assertNull($message->seatRequestParameters->genericDetails->seatCharacteristic);
}

public function testCanMakeRequestMostRestrictive()
{
$par = new AirRetrieveSeatMapOptions([
'flight' => new FlightInfo([
'departureDate' => \DateTime::createFromFormat('Ymd-His', '20150615-000000', new \DateTimeZone('UTC')),
'departure' => 'CDG',
'arrival' => 'YUL',
'airline' => 'AF',
'flightNumber' => '0346',
'bookingClass' => 'Y'
]),
'recordLocator' => '7BFHEJ',
'company' => '1A',
'date' => \DateTime::createFromFormat('Ymd-His', '20150610-000000', new \DateTimeZone('UTC')),
'mostRestrictive' => true
]);

$message = new RetrieveSeatMap($par);

$this->assertEquals('7BFHEJ', $message->resControlInfo->reservation->controlNumber);
$this->assertNull($message->resControlInfo->reservation->controlType);
$this->assertEquals('1A', $message->resControlInfo->reservation->companyId);
$this->assertEquals('100615', $message->resControlInfo->reservation->date);
$this->assertNull($message->resControlInfo->reservation->time);

$this->assertEquals('MRE', $message->processIndicators->statusInformation[0]->action);
}
}

0 comments on commit fec48d8

Please sign in to comment.