Skip to content

Commit

Permalink
Added office ids
Browse files Browse the repository at this point in the history
  • Loading branch information
bimusiek committed Feb 24, 2017
1 parent e8ff063 commit ffdf3a7
Show file tree
Hide file tree
Showing 6 changed files with 200 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -225,4 +225,11 @@ class FareMasterPricerTbSearch extends Base
* @var Fare\MPFareFamily[]
*/
public $fareFamilies = [];

/**
* Office IDs
*
* @var string[]
*/
public $officeIds = [];
}
47 changes: 47 additions & 0 deletions src/Amadeus/Client/Struct/Fare/MasterPricer/OfficeIdDetails.php
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\Fare\MasterPricer;

/**
* OfficeIdDetails
*
* @package Amadeus\Client\Struct\Fare\MasterPricer
* @author Mike Hernas <mike@ahoy.io>
*/
class OfficeIdDetails
{
/**
* OfficeId Information
*
* @var OfficeIdInformation
*/
public $officeIdInformation;

/**
* @param string $officeId
*/
public function __construct($officeId)
{
$this->officeIdInformation = new OfficeIdInformation($officeId);
}
}
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\Fare\MasterPricer;

/**
* OfficeIdInformation
*
* @package Amadeus\Client\Struct\Fare\MasterPricer
* @author Mike Hernas <mike@ahoy.io>
*/
class OfficeIdInformation
{
/**
* OfficeId Identification
*
* @var OfficeIdentification
*/
public $officeIdentification;

/**
* @param string $officeId
*/
public function __construct($officeId)
{
$this->officeIdentification = new OfficeIdentification($officeId);
}
}
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\Fare\MasterPricer;

/**
* OfficeIdentification
*
* @package Amadeus\Client\Struct\Fare\MasterPricer
* @author Mike Hernas <mike@ahoy.io>
*/
class OfficeIdentification
{
/**
* Agent Sign In
*
* @var string
*/
public $agentSignin;

/**
* @param string $officeId
*/
public function __construct($officeId)
{
$this->agentSignin = $officeId;
}
}
14 changes: 13 additions & 1 deletion src/Amadeus/Client/Struct/Fare/MasterPricerTravelBoardSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class MasterPricerTravelBoardSearch extends BaseWsMessage
*/
public $feeOption;
/**
* @var mixed
* @var MasterPricer\OfficeIdDetails[]
*/
public $officeIdDetails;

Expand Down Expand Up @@ -164,6 +164,10 @@ protected function loadOptions($options)
$this->loadItinerary($itinerary, $segmentCounter);
}

foreach ($options->officeIds as $officeId) {
$this->loadOfficeId($officeId);
}

if ($this->checkAnyNotEmpty(
$options->cabinClass,
$options->cabinOption,
Expand All @@ -188,6 +192,14 @@ protected function loadOptions($options)
$this->loadFareFamilies($options->fareFamilies);
}

/**
* @param string $officeId
*/
protected function loadOfficeId($officeId)
{
$this->officeIdDetails[] = new MasterPricer\OfficeIdDetails($officeId);
}

/**
* @param MPPassenger $passenger
* @param int $counter BYREF
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,45 @@ public function testCanMakeMessageWithPublishedUnifaresCorporateUnifares()
$this->assertEquals(FareMasterPricerTbSearch::CORPORATE_QUALIFIER_UNIFARE, $message->fareOptions->corporate->corporateId[0]->corporateQualifier);
}

public function testCanMakeMessageWithManyOfficeIDs()
{
$opt = new FareMasterPricerTbSearch([
'nrOfRequestedResults' => 30,
'nrOfRequestedPassengers' => 1,
'passengers' => [
new MPPassenger([
'type' => MPPassenger::TYPE_ADULT,
'count' => 1
])
],
'itinerary' => [
new MPItinerary([
'departureLocation' => new MPLocation(['city' => 'BER']),
'arrivalLocation' => new MPLocation(['city' => 'MOW']),
'date' => new MPDate([
'dateTime' => new \DateTime('2017-05-01T00:00:00+0000', new \DateTimeZone('UTC'))
])
])
],
'flightOptions' => [
FareMasterPricerTbSearch::FLIGHTOPT_PUBLISHED,
FareMasterPricerTbSearch::FLIGHTOPT_UNIFARES,
FareMasterPricerTbSearch::FLIGHTOPT_CORPORATE_UNIFARES,
],
'officeIds' => ['A', 'B']
]);

$message = new MasterPricerTravelBoardSearch($opt);

$this->assertCount(2, $message->officeIdDetails);
$this->assertEquals('A',
$message->officeIdDetails[0]->officeIdInformation->officeIdentification->agentSignin
);
$this->assertEquals('B',
$message->officeIdDetails[1]->officeIdInformation->officeIdentification->agentSignin
);
}

public function testCanMakeMessageWithPriceToBeat()
{
$opt = new FareMasterPricerTbSearch([
Expand Down

0 comments on commit ffdf3a7

Please sign in to comment.