Skip to content

Commit

Permalink
Support for Air_MultiAvailability (issue #99)
Browse files Browse the repository at this point in the history
  • Loading branch information
DerMika committed Nov 1, 2017
1 parent c14f90b commit d7787c6
Show file tree
Hide file tree
Showing 24 changed files with 735 additions and 15 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
* Added support for Vendor Code in FOP for Fare Pricing messages (https://github.com/amabnl/amadeus-ws-client/pull/82) - Michal Hernas
* Added support in PNR_Retrieve for retrieving the PNR active in context (https://github.com/amabnl/amadeus-ws-client/pull/88) - Michal Hernas
* Added support for Tour Code elements in ``PNR_AddMultiElements`` (https://github.com/amabnl/amadeus-ws-client/issues/90)
* Implemented ``FOP_ValidateFOP`` (https://github.com/amabnl/amadeus-ws-client/pull/86) - Michal Hernas
* Added support for Multi-Ticket operation for MasterPricer messages (https://github.com/amabnl/amadeus-ws-client/pull/94) - Michal Hernas
* Added support for ``Air_MultiAvailability`` messages version 16. (https://github.com/amabnl/amadeus-ws-client/issues/99)
* Implemented ``FOP_ValidateFOP`` (https://github.com/amabnl/amadeus-ws-client/pull/86) - Michal Hernas

# Release 1.4.0 (15 May 2017)
* Added support for ``Fare_PricePNRWithBookingClass`` errors in message version 7.3 format (https://github.com/amabnl/amadeus-ws-client/issues/57)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ class MultiAvailabilityConv extends BaseConverter
*/
public function convert($requestOptions, $version)
{
return new Struct\Air\MultiAvailability($requestOptions);
if (floatval($version) < floatval(16)) {
return new Struct\Air\MultiAvailability($requestOptions);
} else {
return new Struct\Air\MultiAvailability16($requestOptions);
}
}
}
9 changes: 7 additions & 2 deletions src/Amadeus/Client/Struct/Air/MultiAvailability.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@
use Amadeus\Client\Struct\Air\MultiAvailability\FrequentTraveller;
use Amadeus\Client\Struct\Air\MultiAvailability\PointOfCommencement;
use Amadeus\Client\Struct\Air\MultiAvailability\RequestSection;
use Amadeus\Client\Struct\Air\MultiAvailability\RequestSection16;
use Amadeus\Client\Struct\BaseWsMessage;

/**
* MultiAvailability
* Air_MultiAvailability version 15 and below
*
* @package Amadeus\Client\Struct\Air
* @author Dieter Devlieghere <dermikagh@gmail.com>
Expand Down Expand Up @@ -73,7 +74,11 @@ public function __construct(AirMultiAvailabilityOptions $params)

if (count($params->requestOptions) > 0) {
foreach ($params->requestOptions as $requestOption) {
$this->requestSection[] = new RequestSection($requestOption);
if ($this instanceof MultiAvailability16) {
$this->requestSection[] = new RequestSection16($requestOption);
} else {
$this->requestSection[] = new RequestSection($requestOption);
}
}
}

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

/**
* AttributeDetails
*
* @package Amadeus\Client\Struct\Air\MultiAvailability
* @author Dieter Devlieghere <dermikagh@gmail.com>
*/
class AttributeDetails
{
const TYPE_AVLFORGROUPCAPPED_EX = "AGC";
const TYPE_AVAILABILITYCAP_EX = "AVC";
const TYPE_AWARD_PROGRAM = "AWP";
const TYPE_AWARD_ZONE = "AWZ";
const TYPE_BATCHAVSREFRESH_EX = "BAR";
const TYPE_BIDPRICEAVLTHRESHOLD_AIRL = "BAT";
const TYPE_BATCHAVS_EX = "BAV";
const TYPE_BOARD_POINT = "BOA";
const TYPE_BOARD_CODE_CONTEXT = "BPR";
const TYPE_BIDPRICEPRORATIONTOLERANCE_AIRL = "BPT";
const TYPE_CABINS_ORDER_AIRL = "CAO";
const TYPE_CARRIERCURRENCYCODE_AIRL = "CCC";
const TYPE_CROSSCABINGLOBALSWITCH_AIRL = "CCS";
const TYPE_CLASSES_ORDER_AIRL = "CLO";
const TYPE_CONFIRMPGAVLOK_EX = "CPG";
const TYPE_CONFIRMSGAVLOK_EX = "CSG";
const TYPE_DBI_INFO_CORP_CREDIT_CARD = "DBI";
const TYPE_SECTOR_DISTANCE = "DIS";
const TYPE_EOTACCEPTML_EX = "EML";
const TYPE_MAX_ELAPSED_TIME = "ETT";
const TYPE_EFFECTIVEYIELDMTHD_AIRL = "EYM";
const TYPE_FLIGHTCONNECTIONTIMELIMIT_AIRL = "FCT";
const TYPE_INTERPOLATEBETWEENBUCKETS_AIRL = "IB";
const TYPE_INCREMENTAL_WAITING_TIME = "ILT";
const TYPE_LOCATION_EX = "LOC";
const TYPE_MAX_CONNECTING_TIME = "MAX";
const TYPE_MLENFORCMENTTIMELIMIT_EX = "MET";
const TYPE_MIN_CONNECTING_TIME = "MIN";
const TYPE_MAXLINES_EX = "ML";
const TYPE_MLENFORCED_EX = "MLE";
const TYPE_SETMLWITHTTY_EX = "MLT";
const TYPE_NO = "N";
const TYPE_NAVSFORMAT_EX = "NAF";
const TYPE_ROMANIZABLE_NATIVE_NAME = "NN1";
const TYPE_NONROMANIZABLE_NATIVE_NAME = "NN2";
const TYPE_NO_FARE_FOR_OFFER = "NOF";
const TYPE_MAX_NR_OF_SERVICES_CHANGES = "NSC";
const TYPE_MAX_NR_OF_TRANPORT_TYPE_CHANGES = "NTC";
const TYPE_ONDAVAILABILITYGLOBALSWITCH_AIRL = "OAS";
const TYPE_OFFER_ACTIVE = "OFA";
const TYPE_OFFER_EXPIRED = "OFE";
const TYPE_OFF_POINT = "OFF";
const TYPE_OFFER_CONFIRMED = "OFK";
const TYPE_OFFER_PARTIALLY_CONFIRMED = "OFP";
const TYPE_OFFER_UNAVAILABLE = "OFU";
const TYPE_OFF_CODE_CONTEXT = "OPR";
const TYPE_PAYMENT = "PAY";
const TYPE_PACKAGE_NAME = "PKG";
const TYPE_PROTECTFOROVERSALE_AIRL = "PO";
const TYPE_REVENUECONTROLBIDPRICEMETHOD_AIRL = "RBP";
const TYPE_REVENUECONTROLGLOBALSWITCH_AIRL = "RCS";
const TYPE_ROMANIZATION_NATIVE_ASCII = "RN1";
const TYPE_ROMANIZATION_NATIVE_EXT_ASCII = "RN2";
const TYPE_RETURN_ONE_WAY = "ROW";
const TYPE_REJECTSSATEOT_AIRL = "RSE";
const TYPE_REJECTSSALLOWEDHOURS_AIRL = "RSH";
const TYPE_SENDAVSPERSEGMENT_EX = "SAS";
const TYPE_SELECTIVEPOLLINGFORMAT_EX = "SPF";
const TYPE_RETURN_INTERMEDIATE_STOP_TAG = "STO";
const TYPE_SENDWAITLISTCLOSED_EX = "SWC";
const TYPE_TTYADDRESS_EX_AIRL = "TAD";
const TYPE_TIMINGCHANGELOWERVALUE_AIRL = "TLV";
const TYPE_TIMINGCHANGEMCTFACTOR_AIRL = "TMF";
const TYPE_TURNAROUND_POINT = "TPT";
const TYPE_TRAIN_TYPE = "TRA";
const TYPE_TRANSPORT_TYPE = "TRT";
const TYPE_TIMINGCHANGEUPPERVALUE_AIRL = "TUV";
const TYPE_TYPE_EX = "TYP";
const TYPE_UNIVERSAL_NAME = "UN";
const TYPE_YES = "Y";

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

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

/**
* AttributeDetails constructor.
*
* @param string $attributeType
* @param string $attributeDescription
*/
public function __construct($attributeType, $attributeDescription)
{
$this->attributeType = $attributeType;
$this->attributeDescription = $attributeDescription;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ class AvailabilityOptions
public $optionInfo = [];

/**
* @var ProductAvailability
* @var ProductAvailability[]
*/
public $productAvailability;
public $productAvailability = [];

/**
* @var string
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?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\MultiAvailability;

/**
* AvailabilityOptions16
*
* @package Amadeus\Client\Struct\Air\MultiAvailability
* @author Dieter Devlieghere <dermikagh@gmail.com>
*/
class AvailabilityOptions16
{
const REQ_TYPE_SPECIFIC_FLIGHT = "SF";
const REQ_TYPE_BY_ARRIVAL_TIME = "TA";
const REQ_TYPE_BY_DEPARTURE_TIME = "TD";
const REQ_TYPE_BY_ELAPSED_TIME = "TE";
const REQ_TYPE_GROUP_AVAILABILITY = "TG";
const REQ_TYPE_NEUTRAL_ORDER = "TN";
const REQ_TYPE_NEGOTIATED_SPACE = "TT";


/**
* self::REQ_TYPE_*
*
* @var string
*/
public $typeOfRequest;

/**
* @var OptionInfo16[]
*/
public $optionInfo = [];

/**
* @var ProductAvailability[]
*/
public $productAvailability = [];

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

/**
* AvailabilityOptions constructor.
*
* @param string $requestType self::::REQ_TYPE_*
*/
public function __construct($requestType)
{
$this->typeOfRequest = $requestType;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?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\MultiAvailability;

use Amadeus\Client\Struct\Info\LocationDescription;

/**
* ConnectionContext
*
* @package Amadeus\Client\Struct\Air\MultiAvailability
* @author Dieter Devlieghere <dermikagh@gmail.com>
*/
class ConnectionContext
{
/**
* @var string
*/
public $locationType;
/**
* @var LocationDescription
*/
public $locationDescription;
/**
* @var LocationDescription
*/
public $firstLocationDetails;
/**
* @var LocationDescription
*/
public $secondLocationDetails;
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
*/
class FrequentTravellerDetails
{
const REFTYPE_FREQUENT_FLYER = "FF";
const REFTYPE_CORPORATE_FREQUENT_FLYER = "CFF";

/**
* @var string
*/
Expand Down Expand Up @@ -52,6 +55,8 @@ class FrequentTravellerDetails
*/
public $customerValue;
/**
* self::REFTYPE_*
*
* @var string
*/
public $referenceType;
Expand All @@ -61,7 +66,7 @@ class FrequentTravellerDetails
*
* @param string $carrier
* @param string $number
* @param string|null $refType
* @param string|null $refType self::REFTYPE_*
*/
public function __construct($carrier, $number, $refType = null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,16 @@
*/
class NegoSpaceDetails
{
/**
* @var string
*/
public $tourName;
/**
* @var string
*/
public $tourReference;
/**
* @var string
*/
public $recordLocator;
}
Loading

0 comments on commit d7787c6

Please sign in to comment.