diff --git a/CHANGELOG.md b/CHANGELOG.md index e1292f0e0..f885ac366 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ # Release 1.4.0 (UNRELEASED) * Added support for Seat Request elements in in ``PNR_AddMultiElements`` (https://github.com/amabnl/amadeus-ws-client/issues/64/) * Implemented ``DocRefund_InitRefund`` (https://github.com/amabnl/amadeus-ws-client/issues/56) +* Implemented ``Hotel_MultiSingleAvailability`` +* Implemented ``Hotel_Sell`` # Release 1.3.0 (5 April 2017) * Added support for Multiple Office ID's in ``Fare_MasterPricerTravelBoardSearch`` (https://github.com/amabnl/amadeus-ws-client/pull/44) - Michal Hernas @@ -45,6 +47,7 @@ * Implemented ``PNR_NameChange`` message * Implemented ``FOP_CreateFormOfPayment`` message * Implemented ``PointOfRef_Search`` message +* Implemented ``Hotel_Sell`` message * Request Creator split up in 1 dedicated class per message. * Response Handler split up in 1 dedicated class per message. diff --git a/composer.lock b/composer.lock index 4b0689583..9c2c7d224 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,6 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "456c3561ae8edacaf16fc96bee9bdc3a", "content-hash": "50e7b1888a2d37980098b7716396c50f", "packages": [ { @@ -43,7 +42,7 @@ "psr", "psr-3" ], - "time": "2012-12-21 11:40:51" + "time": "2012-12-21T11:40:51+00:00" } ], "packages-dev": [ @@ -99,7 +98,7 @@ "constructor", "instantiate" ], - "time": "2015-06-14 21:17:01" + "time": "2015-06-14T21:17:01+00:00" }, { "name": "phpdocumentor/reflection-docblock", @@ -148,7 +147,7 @@ "email": "mike.vanriel@naenius.com" } ], - "time": "2015-02-03 12:10:50" + "time": "2015-02-03T12:10:50+00:00" }, { "name": "phpspec/prophecy", @@ -211,7 +210,7 @@ "spy", "stub" ], - "time": "2017-03-02 20:05:34" + "time": "2017-03-02T20:05:34+00:00" }, { "name": "phpunit/php-code-coverage", @@ -273,7 +272,7 @@ "testing", "xunit" ], - "time": "2015-10-06 15:47:00" + "time": "2015-10-06T15:47:00+00:00" }, { "name": "phpunit/php-file-iterator", @@ -320,7 +319,7 @@ "filesystem", "iterator" ], - "time": "2016-10-03 07:40:28" + "time": "2016-10-03T07:40:28+00:00" }, { "name": "phpunit/php-text-template", @@ -361,7 +360,7 @@ "keywords": [ "template" ], - "time": "2015-06-21 13:50:34" + "time": "2015-06-21T13:50:34+00:00" }, { "name": "phpunit/php-timer", @@ -410,7 +409,7 @@ "keywords": [ "timer" ], - "time": "2017-02-26 11:10:40" + "time": "2017-02-26T11:10:40+00:00" }, { "name": "phpunit/php-token-stream", @@ -459,7 +458,7 @@ "keywords": [ "tokenizer" ], - "time": "2017-02-27 10:12:30" + "time": "2017-02-27T10:12:30+00:00" }, { "name": "phpunit/phpunit", @@ -531,7 +530,7 @@ "testing", "xunit" ], - "time": "2017-02-06 05:18:07" + "time": "2017-02-06T05:18:07+00:00" }, { "name": "phpunit/phpunit-mock-objects", @@ -587,7 +586,7 @@ "mock", "xunit" ], - "time": "2015-10-02 06:51:40" + "time": "2015-10-02T06:51:40+00:00" }, { "name": "sebastian/comparator", @@ -651,7 +650,7 @@ "compare", "equality" ], - "time": "2017-01-29 09:50:25" + "time": "2017-01-29T09:50:25+00:00" }, { "name": "sebastian/diff", @@ -703,7 +702,7 @@ "keywords": [ "diff" ], - "time": "2015-12-08 07:14:41" + "time": "2015-12-08T07:14:41+00:00" }, { "name": "sebastian/environment", @@ -753,7 +752,7 @@ "environment", "hhvm" ], - "time": "2016-08-18 05:49:44" + "time": "2016-08-18T05:49:44+00:00" }, { "name": "sebastian/exporter", @@ -820,7 +819,7 @@ "export", "exporter" ], - "time": "2016-06-17 09:04:28" + "time": "2016-06-17T09:04:28+00:00" }, { "name": "sebastian/global-state", @@ -871,7 +870,7 @@ "keywords": [ "global state" ], - "time": "2015-10-12 03:26:01" + "time": "2015-10-12T03:26:01+00:00" }, { "name": "sebastian/recursion-context", @@ -924,7 +923,7 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2016-10-03 07:41:43" + "time": "2016-10-03T07:41:43+00:00" }, { "name": "sebastian/version", @@ -959,7 +958,7 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2015-06-21 13:59:46" + "time": "2015-06-21T13:59:46+00:00" }, { "name": "symfony/yaml", @@ -1008,7 +1007,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2015-11-30 12:35:10" + "time": "2015-11-30T12:35:10+00:00" } ], "aliases": [], diff --git a/docs/list-of-supported-messages.rst b/docs/list-of-supported-messages.rst index 94b100395..4d82ec28c 100644 --- a/docs/list-of-supported-messages.rst +++ b/docs/list-of-supported-messages.rst @@ -48,6 +48,8 @@ This is the list of messages that are at least partially supported at this time: - DocIssuance_IssueCombined - DocRefund_InitRefund - Service_IntegratedPricing +- Hotel_MultiSingleAvailability +- Hotel_Sell - Offer_CreateOffer - Offer_VerifyOffer - Offer_ConfirmAirOffer @@ -87,10 +89,8 @@ These messages will be implemented at some point in the future. *Pull requests a - Service_IntegratedCatalogue - Service_PriceServiceViaCatalogue - Service_PriceIntegratedMode -- Hotel_MultiSingleAvailability - Hotel_DescriptiveInfo - Hotel_EnhancedPricing -- Hotel_Sell - Hotel_CompleteReservationDetails - Hotel_Terms - Car_Availability diff --git a/docs/samples.rst b/docs/samples.rst index 249237d4b..857f86ba5 100644 --- a/docs/samples.rst +++ b/docs/samples.rst @@ -2046,6 +2046,14 @@ Assign an account code to a passenger: ]) ); +***** +Hotel +***** +---------- +Hotel_Sell +---------- + +*coming soon* *** FOP diff --git a/src/Amadeus/Client.php b/src/Amadeus/Client.php index d6b1381a6..07206ecdd 100644 --- a/src/Amadeus/Client.php +++ b/src/Amadeus/Client.php @@ -997,6 +997,36 @@ public function fopCreateFormOfPayment(RequestOptions\FopCreateFopOptions $optio return $this->callMessage($msgName, $options, $messageOptions); } + /** + * Hotel_MultiSingleAvailability + * + * @param RequestOptions\HotelMultiSingleAvailOptions $options + * @param array $messageOptions (OPTIONAL) + * @return Result + */ + public function hotelMultiSingleAvailability( + RequestOptions\HotelMultiSingleAvailOptions $options, + $messageOptions = [] + ) { + $msgName = 'Hotel_MultiSingleAvailability'; + + return $this->callMessage($msgName, $options, $messageOptions); + } + + /** + * Hotel_Sell + * + * @param RequestOptions\HotelSellOptions $options + * @param array $messageOptions (OPTIONAL) + * @return Result + */ + public function hotelSell(RequestOptions\HotelSellOptions $options, $messageOptions = []) + { + $msgName = 'Hotel_Sell'; + + return $this->callMessage($msgName, $options, $messageOptions); + } + /** * PriceXplorer_ExtremeSearch * diff --git a/src/Amadeus/Client/RequestCreator/Converter/Hotel/MultiSingleAvailabilityConv.php b/src/Amadeus/Client/RequestCreator/Converter/Hotel/MultiSingleAvailabilityConv.php new file mode 100644 index 000000000..63ed95a72 --- /dev/null +++ b/src/Amadeus/Client/RequestCreator/Converter/Hotel/MultiSingleAvailabilityConv.php @@ -0,0 +1,46 @@ + + */ +class MultiSingleAvailabilityConv extends BaseConverter +{ + /** + * @param HotelMultiSingleAvailOptions $requestOptions + * @param int|string $version + * @return Struct\Hotel\MultiSingleAvailability + */ + public function convert($requestOptions, $version) + { + return new Struct\Hotel\MultiSingleAvailability($requestOptions); + } +} diff --git a/src/Amadeus/Client/RequestCreator/Converter/Hotel/SellConv.php b/src/Amadeus/Client/RequestCreator/Converter/Hotel/SellConv.php new file mode 100644 index 000000000..c55e9300e --- /dev/null +++ b/src/Amadeus/Client/RequestCreator/Converter/Hotel/SellConv.php @@ -0,0 +1,46 @@ + + */ +class SellConv extends BaseConverter +{ + /** + * @param HotelSellOptions $requestOptions + * @param int|string $version + * @return Struct\Hotel\Sell + */ + public function convert($requestOptions, $version) + { + return new Struct\Hotel\Sell($requestOptions); + } +} diff --git a/src/Amadeus/Client/RequestOptions/Hotel/MultiSingleAvail/Criteria.php b/src/Amadeus/Client/RequestOptions/Hotel/MultiSingleAvail/Criteria.php new file mode 100644 index 000000000..8fdf0f207 --- /dev/null +++ b/src/Amadeus/Client/RequestOptions/Hotel/MultiSingleAvail/Criteria.php @@ -0,0 +1,73 @@ + + */ +class Criteria extends LoadParamsFromArray +{ + const ALT_AVAIL_NEVER = "Never"; + + /** + * @var bool + */ + public $exactMatch; + + /** + * @var HotelReference[] + */ + public $hotelReferences = []; + + /** + * @var \DateTime + */ + public $stayStart; + + /** + * @var \DateTime + */ + public $stayEnd; + + /** + * @var Rates[] + */ + public $rates = []; + + /** + * @var Room[] + */ + public $rooms = []; + + /** + * self::ALT_AVAIL_* + * + * @var string + */ + public $alternateAvailability; +} diff --git a/src/Amadeus/Client/RequestOptions/Hotel/MultiSingleAvail/Guest.php b/src/Amadeus/Client/RequestOptions/Hotel/MultiSingleAvail/Guest.php new file mode 100644 index 000000000..7284e8699 --- /dev/null +++ b/src/Amadeus/Client/RequestOptions/Hotel/MultiSingleAvail/Guest.php @@ -0,0 +1,69 @@ + + */ +class Guest extends LoadParamsFromArray +{ + const OCCUPANT_OVER_21 = 1; + const OCCUPANT_OVER_65 = 2; + const OCCUPANT_UNDER_2 = 3; + const OCCUPANT_UNDER_12 = 4; + const OCCUPANT_UNDER_17 = 5; + const OCCUPANT_UNDER_21 = 6; + const OCCUPANT_INFANT = 7; + const OCCUPANT_CHILD = 8; + const OCCUPANT_TEENAGER = 9; + const OCCUPANT_ADULT = 10; + const OCCUPANT_SENIOR = 11; + const OCCUPANT_ADDITIONAL_WITH_ADULT = 12; + const OCCUPANT_ADDITIONAL_WITHOUT_ADULT = 13; + const OCCUPANT_FREE_CHILD = 14; + const OCCUPANT_FREE_ADULT = 15; + const OCCUPANT_YOUNG_DRIVER = 16; + const OCCUPANT_YOUNGER_DRIVER = 17; + const OCCUPANT_UNDER_10 = 18; + + /** + * Age Qualifying code + * + * self::OCCUPANT_* + * + * @var string + */ + public $occupantCode; + + /** + * How many guests? + * + * @var int + */ + public $amount; +} diff --git a/src/Amadeus/Client/RequestOptions/Hotel/MultiSingleAvail/HotelReference.php b/src/Amadeus/Client/RequestOptions/Hotel/MultiSingleAvail/HotelReference.php new file mode 100644 index 000000000..709921772 --- /dev/null +++ b/src/Amadeus/Client/RequestOptions/Hotel/MultiSingleAvail/HotelReference.php @@ -0,0 +1,59 @@ + + */ +class HotelReference extends LoadParamsFromArray +{ + /** + * @var string + */ + public $chainCode; + + /** + * @var string + */ + public $cityCode; + + /** + * @var string + */ + public $name; + + /** + * @var string + */ + public $hotelCode; + + /** + * @var string + */ + public $codeContext; +} diff --git a/src/Amadeus/Client/RequestOptions/Hotel/MultiSingleAvail/Rates.php b/src/Amadeus/Client/RequestOptions/Hotel/MultiSingleAvail/Rates.php new file mode 100644 index 000000000..a5ff09dc4 --- /dev/null +++ b/src/Amadeus/Client/RequestOptions/Hotel/MultiSingleAvail/Rates.php @@ -0,0 +1,67 @@ + + */ +class Rates extends LoadParamsFromArray +{ + const TIMEUNIT_YEAR = "Year"; + const TIMEUNIT_MONTH = "Month"; + const TIMEUNIT_WEEK = "Week"; + const TIMEUNIT_DAY = "Day"; + const TIMEUNIT_HOUR = "Hour"; + const TIMEUNIT_SECOND = "Second"; + const TIMEUNIT_FULL_DURATION = "FullDuration"; + const TIMEUNIT_MINUTE = "Minute"; + + /** + * @var double + */ + public $min; + + /** + * @var double + */ + public $max; + + /** + * self::TIMEUNIT_* + * + * @var string + */ + public $timeUnit; + + /** + * 3-character ISO currency code + * + * @var string + */ + public $currency; +} diff --git a/src/Amadeus/Client/RequestOptions/Hotel/MultiSingleAvail/Room.php b/src/Amadeus/Client/RequestOptions/Hotel/MultiSingleAvail/Room.php new file mode 100644 index 000000000..105cdb643 --- /dev/null +++ b/src/Amadeus/Client/RequestOptions/Hotel/MultiSingleAvail/Room.php @@ -0,0 +1,60 @@ + + */ +class Room extends LoadParamsFromArray +{ + /** + * Your unique ID for this room request + * + * @var int + */ + public $id; + + /** + * How many rooms? + * + * @var int + */ + public $amount; + + /** + * All guests share the same room? + * + * @var bool + */ + public $guestsIsPerRoom = true; + + /** + * @var Guest[] + */ + public $guests = []; +} diff --git a/src/Amadeus/Client/RequestOptions/Hotel/MultiSingleAvail/Segment.php b/src/Amadeus/Client/RequestOptions/Hotel/MultiSingleAvail/Segment.php new file mode 100644 index 000000000..83bb31766 --- /dev/null +++ b/src/Amadeus/Client/RequestOptions/Hotel/MultiSingleAvail/Segment.php @@ -0,0 +1,60 @@ + + */ +class Segment extends LoadParamsFromArray +{ + const SOURCE_LEISURE = "Leisure"; + const SOURCE_DISTRIBUTION = "Distribution"; + const SOURCE_MULTI_SOURCE = "MultiSource"; + + /** + * self::SOURCE_* + * + * @var string + */ + public $infoSource; + + /** + * @var bool + */ + public $bestOnly; + + /** + * @var bool + */ + public $availableOnly; + + /** + * @var Criteria[] + */ + public $criteria = []; +} diff --git a/src/Amadeus/Client/RequestOptions/Hotel/Sell/Booker.php b/src/Amadeus/Client/RequestOptions/Hotel/Sell/Booker.php new file mode 100644 index 000000000..384108e31 --- /dev/null +++ b/src/Amadeus/Client/RequestOptions/Hotel/Sell/Booker.php @@ -0,0 +1,63 @@ + + */ +class Booker extends LoadParamsFromArray +{ + /** + * Number of travellers + * + * @var int + */ + public $travellerCount = 1; + + /** + * @var string + */ + public $firstName; + + /** + * @var string + */ + public $lastName; + + /** + * @var string + */ + public $title; + + /** + * Gender - 'M' or 'F' + * + * @var string + */ + public $gender; +} diff --git a/src/Amadeus/Client/RequestOptions/Hotel/Sell/BookingCompany.php b/src/Amadeus/Client/RequestOptions/Hotel/Sell/BookingCompany.php new file mode 100644 index 000000000..61d54564a --- /dev/null +++ b/src/Amadeus/Client/RequestOptions/Hotel/Sell/BookingCompany.php @@ -0,0 +1,53 @@ + + */ +class BookingCompany extends LoadParamsFromArray +{ + const TYPE_BRAND = "BRA"; + const TYPE_CORPORATION_NAME = "CORP"; + const TYPE_SUB_BRAND = "SBR"; + const TYPE_SUB_SUB_BRAND = "SSB"; + + /** + * self::TYPE_* + * + * @var string + */ + public $type; + + /** + * The name of the booking company + * + * @var string + */ + public $name; +} diff --git a/src/Amadeus/Client/RequestOptions/HotelMultiSingleAvailOptions.php b/src/Amadeus/Client/RequestOptions/HotelMultiSingleAvailOptions.php new file mode 100644 index 000000000..44b1b06a9 --- /dev/null +++ b/src/Amadeus/Client/RequestOptions/HotelMultiSingleAvailOptions.php @@ -0,0 +1,130 @@ + + */ +class HotelMultiSingleAvailOptions extends Base +{ + const SORT_NONE = "N"; + const SORT_CHEAPEST_FIRST = "RA"; + const SORT_CHEAPEST_LAST = "RD"; + const SORT_PROPERTY_CODE_ALPHABETIC = "CA"; + const SORT_PROPERTY_CODE_REVERSE = "CD"; + const SORT_PROPERTY_NAME_ALPHABETIC = "PA"; + const SORT_PROPERTY_NAME_REVERSE = "PD"; + + const CACHE_LIVE = "Live"; + const CACHE_ONLY = "LessRecent"; + const CACHE_OR_AGGREGATOR = "VeryRecent"; + + /** + * Hotel segments availability requested + * + * @var Hotel\MultiSingleAvail\Segment[] + */ + public $segments = []; + + /** + * Return only rates that are available within the range of the minimum and maximum amount specified + * + * @var bool + */ + public $rateRangeOnly = true; + + /** + * Summary information in the response? + * + * @var bool + */ + public $summaryOnly = true; + + /** + * Should response contain room rate details? + * + * @var bool + */ + public $rateDetails = true; + + /** + * 2-character currency code + * + * @var string + */ + public $requestedCurrency; + + /** + * 2-character language code + * + * @var string + */ + public $languageCode; + + /** + * Include ONLY those rates that are available in the date range specified? + * + * @var bool + */ + public $availableRatesOnly; + + /** + * @var string + */ + public $version = "4.000"; + + /** + * Show only those rates that are an exact match to the requested criteria? + * + * @var bool + */ + public $exactMatchOnly; + + /** + * Sort order of the returned property information + * + * self::SORT_* + * + * @var string + */ + public $sortOrder; + + /** + * How many results? + * + * @var int + */ + public $maxResponses; + + /** + * What caching level to be used + * + * self::CACHE_* + * + * @var string + */ + public $searchCacheLevel; +} diff --git a/src/Amadeus/Client/RequestOptions/HotelSellOptions.php b/src/Amadeus/Client/RequestOptions/HotelSellOptions.php new file mode 100644 index 000000000..cdd322a27 --- /dev/null +++ b/src/Amadeus/Client/RequestOptions/HotelSellOptions.php @@ -0,0 +1,62 @@ + + */ +class HotelSellOptions extends Base +{ + const DELIVER_ERETAIL = "AERE"; + const DELIVER_ETRAVEL_MANAGEMENT = "AETM"; + const DELIVER_COMMAND_PAGE = "COMM"; + const DELIVER_SELL2_SELL_CONNECT = "SECO"; + const DELIVER_SELLING_PLATFORM_CLASSIC = "SELL"; + const DELIVER_NON_SPECIFIC_PRODUCT_FROM_SEL = "SEP"; + const DELIVER_WEBSERVICES = "WEBS"; + + /** + * Booking system identifier + * + * self::DELIVER_* + * + * @var string + */ + public $deliveringSystem; + + /** + * @var BookingCompany[] + */ + public $bookingCompany = []; + + /** + * @var Booker + */ + public $booker; +} diff --git a/src/Amadeus/Client/ResponseHandler/Hotel/HandlerMultiSingleAvailability.php b/src/Amadeus/Client/ResponseHandler/Hotel/HandlerMultiSingleAvailability.php new file mode 100644 index 000000000..358e65711 --- /dev/null +++ b/src/Amadeus/Client/ResponseHandler/Hotel/HandlerMultiSingleAvailability.php @@ -0,0 +1,54 @@ + + */ +class HandlerMultiSingleAvailability extends StandardResponseHandler +{ + const Q_ERR_CODE = "/m:OTA_HotelAvailRS/m:Errors/m:Error/@Code"; + const Q_ERR_SRC = "/m:OTA_HotelAvailRS/m:Errors/m:Error/@Status"; + const Q_ERR_MSG = "/m:OTA_HotelAvailRS/m:Errors/m:Error/@ShortText"; + + /** + * @param SendResult $response + * @return Result + */ + public function analyze(SendResult $response) + { + return $this->analyzeWithErrorCodeMsgQuerySource( + $response, + self::Q_ERR_CODE, + self::Q_ERR_MSG, + self::Q_ERR_SRC + ); + } +} diff --git a/src/Amadeus/Client/ResponseHandler/Hotel/HandlerSell.php b/src/Amadeus/Client/ResponseHandler/Hotel/HandlerSell.php new file mode 100644 index 000000000..0cb2fbdbb --- /dev/null +++ b/src/Amadeus/Client/ResponseHandler/Hotel/HandlerSell.php @@ -0,0 +1,45 @@ + + */ +class HandlerSell extends StandardResponseHandler +{ + /** + * @param SendResult $response + * @return Result + */ + public function analyze(SendResult $response) + { + //TODO + } +} diff --git a/src/Amadeus/Client/ResponseHandler/StandardResponseHandler.php b/src/Amadeus/Client/ResponseHandler/StandardResponseHandler.php index 9152ea4bf..3d6ab8c22 100644 --- a/src/Amadeus/Client/ResponseHandler/StandardResponseHandler.php +++ b/src/Amadeus/Client/ResponseHandler/StandardResponseHandler.php @@ -37,7 +37,9 @@ abstract class StandardResponseHandler implements MessageResponseHandler /** * Default namespace prefix we'll be using for xpath queries * - * Why not "m"? It's as good as any other letter. + * Why not "m"? It's as good as any other letter. And it's short. + * + * If you disagree, 1v1 me at the sun. In highsec, limited engagement. I don't want you blobbing me. */ const XMLNS_PREFIX = "m"; @@ -127,6 +129,50 @@ protected function analyzeWithErrorCodeMsgQueryLevel(SendResult $response, $qErr return $analyzeResponse; } + /** + * Analyze response by looking for error, message and source with the provided XPATH queries + * + * Result status defaults to Result::STATUS_ERROR if any error is found. + * + * xpath queries must be prefixed with the namespace self::XMLNS_PREFIX + * + * @param SendResult $response + * @param string $qErr XPATH query for fetching error code (first node is used) + * @param string $qMsg XPATH query for fetching error messages (all nodes are used) + * @param string $qSrc XPATH query for fetching error source (first node is used) + * @return Result + */ + protected function analyzeWithErrorCodeMsgQuerySource(SendResult $response, $qErr, $qMsg, $qSrc) + { + $analyzeResponse = new Result($response); + + $domXpath = $this->makeDomXpath($response->responseXml); + + $errorCodeNodeList = $domXpath->query($qErr); + + if ($errorCodeNodeList->length > 0) { + $analyzeResponse->status = Result::STATUS_ERROR; + + $srcNodeList = $domXpath->query($qSrc); + $source = null; + + if ($srcNodeList->length > 0) { + $source = $srcNodeList->item(0); + } + + $analyzeResponse->messages[] = new Result\NotOk( + $errorCodeNodeList->item(0)->nodeValue, + $this->makeMessageFromMessagesNodeList( + $domXpath->query($qMsg) + ), + null, + $source + ); + } + + return $analyzeResponse; + } + /** * Analyze response by looking for error, category and message in nodes specified by name * diff --git a/src/Amadeus/Client/Result/NotOk.php b/src/Amadeus/Client/Result/NotOk.php index 45ab90585..e009e8c21 100644 --- a/src/Amadeus/Client/Result/NotOk.php +++ b/src/Amadeus/Client/Result/NotOk.php @@ -31,31 +31,46 @@ class NotOk { /** + * Error/warning code + * * @var mixed */ public $code; /** + * Message + * * @var string */ public $text; /** + * Error/warning level + * * @var string */ public $level; + /** + * Source of error/warning + * + * @var string + */ + public $source; + /** * NotOk constructor. * * @param string|int|null $code * @param string|null $text * @param string|null $level + * @param string|null $source */ - public function __construct($code = null, $text = null, $level = null) + public function __construct($code = null, $text = null, $level = null, $source = null) { $this->code = $code; $this->text = $text; $this->level = $level; + $this->source = $source; } } diff --git a/src/Amadeus/Client/Session/Handler/Base.php b/src/Amadeus/Client/Session/Handler/Base.php index 6336f03cf..30c1a9045 100644 --- a/src/Amadeus/Client/Session/Handler/Base.php +++ b/src/Amadeus/Client/Session/Handler/Base.php @@ -25,6 +25,7 @@ use Amadeus\Client; use Amadeus\Client\Struct\BaseWsMessage; use Amadeus\Client\Params\SessionHandlerParams; +use Amadeus\Client\Session\MsgClassmap\Loader; use Psr\Log\LoggerAwareInterface; use Psr\Log\LoggerAwareTrait; use Psr\Log\LoggerInterface; @@ -75,6 +76,13 @@ abstract class Base implements HandlerInterface, LoggerAwareInterface 'securityToken' => null ]; + /** + * Specific classmap additions to be loaded when certain messages are active. + * + * @var array + */ + protected $messageClassmap = []; + /** * Status variable to know if the session is currently logged in * @@ -313,12 +321,14 @@ public function getOriginatorOffice() * * Result is an associative array: keys are message names, values are versions. * + * @todo messageClassMap per WSDL separately! * @return array */ public function getMessagesAndVersions() { if (empty($this->messagesAndVersions)) { $this->messagesAndVersions = WsdlAnalyser::loadMessagesAndVersions($this->params->wsdl); + $this->messageClassmap = Loader::loadMessagesSpecificClasses($this->messagesAndVersions); } return $this->messagesAndVersions; diff --git a/src/Amadeus/Client/Session/Handler/SoapHeader4.php b/src/Amadeus/Client/Session/Handler/SoapHeader4.php index 1adc95ee4..44abd5b09 100644 --- a/src/Amadeus/Client/Session/Handler/SoapHeader4.php +++ b/src/Amadeus/Client/Session/Handler/SoapHeader4.php @@ -431,7 +431,11 @@ protected function createDateTimeStringForAuth($creationDateTime, $micro) protected function makeSoapClientOptions() { $options = $this->soapClientOptions; - $options['classmap'] = array_merge(Classmap::$soapheader4map, Classmap::$map); + $options['classmap'] = array_merge( + Classmap::$soapheader4map, + Classmap::$map, + $this->messageClassmap + ); if (!empty($this->params->soapClientOptions)) { $options = array_merge($options, $this->params->soapClientOptions); diff --git a/src/Amadeus/Client/Session/MsgClassmap/Hotel/LoaderMultiSingleAvailability.php b/src/Amadeus/Client/Session/MsgClassmap/Hotel/LoaderMultiSingleAvailability.php new file mode 100644 index 000000000..3dd8aa9f5 --- /dev/null +++ b/src/Amadeus/Client/Session/MsgClassmap/Hotel/LoaderMultiSingleAvailability.php @@ -0,0 +1,61 @@ + + */ +class LoaderMultiSingleAvailability implements LoadInterface +{ + /** + * @param float|string $version + * @return array + */ + public static function loadClassMapForMessage($version) + { + return [ + 'ota_2003_05:OTA_HotelAvailRQ' => 'Amadeus\Client\Struct\Hotel\MultiSingleAvailability', + 'ota_2003_05:AvailRequestSegments' => 'Amadeus\Client\Struct\Hotel\MultiSingleAvailability\AvailRequestSegments', + 'ota_2003_05:AvailRequestSegmentsType' => 'Amadeus\Client\Struct\Hotel\MultiSingleAvailability\AvailRequestSegmentsType', + 'ota_2003_05:AvailRequestSegment' => 'Amadeus\Client\Struct\Hotel\MultiSingleAvailability\AvailRequestSegment', + 'ota_2003_05:Criterion' => 'Amadeus\Client\Struct\Hotel\MultiSingleAvailability\Criterion', + 'ota_2003_05:HotelSearchCriterionType' => 'Amadeus\Client\Struct\Hotel\MultiSingleAvailability\HotelSearchCriterionType', + 'ota_2003_05:ItemSearchCriterionType' => 'Amadeus\Client\Struct\Hotel\MultiSingleAvailability\ItemSearchCriterionType', + 'ota_2003_05:GuestCount' => 'Amadeus\Client\Struct\Hotel\MultiSingleAvailability\GuestCount', + 'ota_2003_05:GuestCounts' => 'Amadeus\Client\Struct\Hotel\MultiSingleAvailability\GuestCounts', + 'ota_2003_05:HotelRef' => 'Amadeus\Client\Struct\Hotel\MultiSingleAvailability\HotelRef', + 'ota_2003_05:HotelSearchCriteria' => 'Amadeus\Client\Struct\Hotel\MultiSingleAvailability\HotelSearchCriteria', + 'ota_2003_05:HotelSearchCriteriaType' => 'Amadeus\Client\Struct\Hotel\MultiSingleAvailability\HotelSearchCriteriaType', + 'ota_2003_05:POS_Type' => 'Amadeus\Client\Struct\Hotel\MultiSingleAvailability\PosType', + 'ota_2003_05:RateRange' => 'Amadeus\Client\Struct\Hotel\MultiSingleAvailability\RateRange', + 'ota_2003_05:RoomStayCandidate' => 'Amadeus\Client\Struct\Hotel\MultiSingleAvailability\RoomStayCandidate', + 'ota_2003_05:RoomStayCandidates' => 'Amadeus\Client\Struct\Hotel\MultiSingleAvailability\RoomStayCandidates', + 'ota_2003_05:StayDateRange' => 'Amadeus\Client\Struct\Hotel\MultiSingleAvailability\StayDateRange' + ]; + } +} diff --git a/src/Amadeus/Client/Session/MsgClassmap/LoadInterface.php b/src/Amadeus/Client/Session/MsgClassmap/LoadInterface.php new file mode 100644 index 000000000..31bc2ecf2 --- /dev/null +++ b/src/Amadeus/Client/Session/MsgClassmap/LoadInterface.php @@ -0,0 +1,40 @@ + + */ +interface LoadInterface +{ + /** + * Loads extra class map entries for a given message and version + * + * @param string|float $version + * @return array + */ + public static function loadClassMapForMessage($version); +} diff --git a/src/Amadeus/Client/Session/MsgClassmap/Loader.php b/src/Amadeus/Client/Session/MsgClassmap/Loader.php new file mode 100644 index 000000000..b3f5a32e1 --- /dev/null +++ b/src/Amadeus/Client/Session/MsgClassmap/Loader.php @@ -0,0 +1,120 @@ + + */ +class Loader +{ + /** + * List of messages that need extra classmaps. + * + * @var array + */ + protected static $extraClassMapNeeded = [ + 'Hotel_MultiSingleAvailability' + ]; + + + /** + * Load extra ClassMaps needed for the messages and versions in the WSAP + * + * messagesAndVersions array: + * [ + * 'PNR_Retrieve' => [ + * 'version' => '14.2', + * 'wsdl' => 'a88a2bde' + * ], + * 'Security_Authenticate' => [ + * 'version' => '6.1', + * 'wsdl' => 'a88a2bde' + * ] + * + * @param array $messagesAndVersions + * @return array + */ + public static function loadMessagesSpecificClasses($messagesAndVersions) + { + $msgSpecificClassMap = []; + + foreach ($messagesAndVersions as $message => $messageInfo) { + $msgSpecificClassMap = array_merge( + $msgSpecificClassMap, + self::loadClassMapForMessage($message, $messageInfo["version"]) + ); + } + + return $msgSpecificClassMap; + } + + /** + * Load Message-specific classmap + * + * @param string $message + * @param string|float $version + * @return array + */ + protected static function loadClassMapForMessage($message, $version) + { + $classMap = []; + + if (in_array($message, self::$extraClassMapNeeded)) { + $classMapLoader = self::makeClassMapLoader($message); + + if ($classMapLoader instanceof LoadInterface) { + $classMap = $classMapLoader::loadClassMapForMessage($version); + } + } + + return $classMap; + } + + /** + * @param string $message + * @return LoadInterface|null + */ + protected static function makeClassMapLoader($message) + { + $loader = null; + + $section = substr($message, 0, strpos($message, '_')); + $message = substr($message, strpos($message, '_') + 1); + + $loaderClass = __NAMESPACE__.'\\'.$section.'\\Loader'.$message; + + if (class_exists($loaderClass)) { + /** @var LoadInterface $handler */ + $loader = new $loaderClass(); + } + + return $loader; + } +} diff --git a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability.php b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability.php new file mode 100644 index 000000000..487b91728 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability.php @@ -0,0 +1,155 @@ + + */ +class MultiSingleAvailability extends BaseWsMessage +{ + /** + * @var string + */ + public $EchoToken = 'MultiSingle'; + + /** + * @var string + */ + public $Version; + + /** + * @var bool + */ + public $SummaryOnly = true; + + /** + * @var bool + */ + public $RateRangeOnly = true; + + /** + * @var bool + */ + public $RateDetailsInd = true; + + /** + * @var bool + */ + public $ExactMatchOnly; + + /** + * @var bool + */ + public $AvailRatesOnly; + + /** + * @var bool + */ + public $OnRequestInd; + + /** + * @var string + */ + public $PrimaryLangID; + + /** + * @var string + */ + public $RequestedCurrency; + + + /** + * @var MultiSingleAvailability\AvailRequestSegments + */ + public $AvailRequestSegments; + + /** + * @var MultiSingleAvailability\PosType + */ + public $POS; + + /** + * @var string + */ + public $SortOrder; + + /** + * @var int + */ + public $MaxResponses; + + /** + * @var string + */ + public $SearchCacheLevel; + + /** + * MultiSingleAvailability constructor. + * + * @param HotelMultiSingleAvailOptions $options + */ + public function __construct(HotelMultiSingleAvailOptions $options) + { + $this->loadAttributes($options); + $this->loadSegments($options->segments); + } + + /** + * @param HotelMultiSingleAvailOptions $options + */ + protected function loadAttributes($options) + { + $this->Version = $options->version; + $this->AvailRatesOnly = $options->availableRatesOnly; + $this->ExactMatchOnly = $options->exactMatchOnly; + $this->PrimaryLangID = $options->languageCode; + $this->RateDetailsInd = $options->rateDetails; + $this->RateRangeOnly = $options->rateRangeOnly; + $this->RequestedCurrency = $options->requestedCurrency; + $this->SummaryOnly = $options->summaryOnly; + $this->SortOrder = $options->sortOrder; + $this->MaxResponses = $options->maxResponses; + $this->SearchCacheLevel = $options->searchCacheLevel; + } + + /** + * @param MultiSingleAvail\Segment[] $segments + */ + protected function loadSegments($segments) + { + $this->AvailRequestSegments = new AvailRequestSegments(); + + foreach ($segments as $segment) { + $this->AvailRequestSegments->AvailRequestSegment[] = new AvailRequestSegment($segment); + } + } +} diff --git a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/AcceptedPayments.php b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/AcceptedPayments.php new file mode 100644 index 000000000..fc1ae05df --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/AcceptedPayments.php @@ -0,0 +1,33 @@ + + */ +class AcceptedPayments +{ +} diff --git a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/AvailRequestSegment.php b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/AvailRequestSegment.php new file mode 100644 index 000000000..c5ad2f848 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/AvailRequestSegment.php @@ -0,0 +1,63 @@ + + */ +class AvailRequestSegment +{ + /** + * @var HotelSearchCriteria + */ + public $HotelSearchCriteria; + + /** + * @var string + */ + public $InfoSource; + + public $MoreDataEchoToken; + + /** + * AvailRequestSegment constructor. + * + * @param Segment|null $segment + */ + public function __construct($segment = null) + { + if ($segment instanceof Segment) { + $this->InfoSource = $segment->infoSource; + $this->HotelSearchCriteria = new HotelSearchCriteria( + $segment->criteria, + $segment->bestOnly, + $segment->availableOnly + ); + } + } +} diff --git a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/AvailRequestSegments.php b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/AvailRequestSegments.php new file mode 100644 index 000000000..d6893a603 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/AvailRequestSegments.php @@ -0,0 +1,33 @@ + + */ +class AvailRequestSegments extends AvailRequestSegmentsType +{ +} diff --git a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/AvailRequestSegmentsType.php b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/AvailRequestSegmentsType.php new file mode 100644 index 000000000..687f7a2d0 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/AvailRequestSegmentsType.php @@ -0,0 +1,42 @@ + + */ +class AvailRequestSegmentsType +{ + /** + * @var AvailRequestSegment[] + */ + public $AvailRequestSegment = []; + + /** + * @var int + */ + public $MaximumWaitTime; +} diff --git a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Award.php b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Award.php new file mode 100644 index 000000000..2c6d2df56 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Award.php @@ -0,0 +1,33 @@ + + */ +class Award +{ +} diff --git a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Criterion.php b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Criterion.php new file mode 100644 index 000000000..c631fe691 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Criterion.php @@ -0,0 +1,75 @@ + + */ +class Criterion extends HotelSearchCriterionType +{ + /*** + * @var string + */ + public $AlternateAvailability; + + public $AddressSearchScope; + + public $InfoSource; + + public $MoreDataEchoToken; + + /** + * Criterion constructor. + * + * @param Criteria $criterion + */ + public function __construct(Criteria $criterion) + { + $this->ExactMatch = $criterion->exactMatch; + + foreach ($criterion->hotelReferences as $hotelReference) { + $this->HotelRef[] = new HotelRef($hotelReference); + } + + $this->StayDateRange = new StayDateRange($criterion->stayStart, $criterion->stayEnd); + + foreach ($criterion->rates as $rate) { + $this->RateRange[] = new RateRange($rate); + } + + if (!empty($criterion->rooms)) { + $this->RoomStayCandidates = new RoomStayCandidates(); + + foreach ($criterion->rooms as $room) { + $this->RoomStayCandidates->RoomStayCandidate[] = new RoomStayCandidate($room); + } + } + + $this->AlternateAvailability = $criterion->alternateAvailability; + } +} diff --git a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/GuestCount.php b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/GuestCount.php new file mode 100644 index 000000000..594d6fe63 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/GuestCount.php @@ -0,0 +1,55 @@ + + */ +class GuestCount +{ + public $AgeQualifyingCode; + + public $Age; + + public $Count; + + public $AgeBucket; + + public $ResGuestRPH; + + /** + * GuestCount constructor. + * + * @param Guest $guest + */ + public function __construct(Guest $guest) + { + $this->AgeQualifyingCode = $guest->occupantCode; + $this->Count = $guest->amount; + } +} diff --git a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/GuestCounts.php b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/GuestCounts.php new file mode 100644 index 000000000..14e23eed8 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/GuestCounts.php @@ -0,0 +1,59 @@ + + */ +class GuestCounts +{ + /** + * @var bool + */ + public $IsPerRoom; + + /** + * @var GuestCount[] + */ + public $GuestCount = []; + + /** + * GuestCounts constructor. + * + * @param bool $isPerRoom + * @param Guest[] $guests + */ + public function __construct($isPerRoom, $guests) + { + $this->IsPerRoom = $isPerRoom; + + foreach ($guests as $guest) { + $this->GuestCount[] = new GuestCount($guest); + } + } +} diff --git a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/HotelAmenity.php b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/HotelAmenity.php new file mode 100644 index 000000000..43a8ba21f --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/HotelAmenity.php @@ -0,0 +1,33 @@ + + */ +class HotelAmenity +{ +} diff --git a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/HotelFeature.php b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/HotelFeature.php new file mode 100644 index 000000000..fd5f45b5f --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/HotelFeature.php @@ -0,0 +1,33 @@ + + */ +class HotelFeature +{ +} diff --git a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/HotelMeetingFacility.php b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/HotelMeetingFacility.php new file mode 100644 index 000000000..b8a91af4a --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/HotelMeetingFacility.php @@ -0,0 +1,33 @@ + + */ +class HotelMeetingFacility +{ +} diff --git a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/HotelRef.php b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/HotelRef.php new file mode 100644 index 000000000..390a1b339 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/HotelRef.php @@ -0,0 +1,103 @@ + + */ +class HotelRef +{ + /** + * @var string + */ + public $ChainCode; + + /** + * @var string + */ + public $BrandCode; + + /** + * @var string + */ + public $HotelCode; + + /** + * @var string + */ + public $HotelCityCode; + + /** + * @var string + */ + public $HotelName; + + /** + * @var string + */ + public $HotelCodeContext; + + /** + * @var string + */ + public $ChainName; + + /** + * @var string + */ + public $BrandName; + + /** + * @var string + */ + public $SegmentCategoryCode; + + /** + * @var string + */ + public $LocationCategoryCode; + + /** + * @var string + */ + public $ExtendedCitySearchIndicator; + + /** + * HotelRef constructor. + * + * @param HotelReference $ref + */ + public function __construct(HotelReference $ref) + { + $this->ChainCode = $ref->chainCode; + $this->HotelCityCode = $ref->cityCode; + $this->HotelCodeContext = $ref->codeContext; + $this->HotelCode = $ref->hotelCode; + $this->HotelName = $ref->name; + } +} diff --git a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/HotelSearchCriteria.php b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/HotelSearchCriteria.php new file mode 100644 index 000000000..a92b689a4 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/HotelSearchCriteria.php @@ -0,0 +1,33 @@ + + */ +class HotelSearchCriteria extends HotelSearchCriteriaType +{ +} diff --git a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/HotelSearchCriteriaType.php b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/HotelSearchCriteriaType.php new file mode 100644 index 000000000..fb0d836ff --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/HotelSearchCriteriaType.php @@ -0,0 +1,68 @@ + + */ +class HotelSearchCriteriaType +{ + /** + * @var Criterion[] + */ + public $Criterion = []; + + /** + * @var bool + */ + public $BestOnlyIndicator; + + /** + * @var bool + */ + public $AvailableOnlyIndicator; + + public $TotalAfterTaxOnlyInd; + + /** + * HotelSearchCriteriaType constructor. + * + * @param Criteria[] $criteria + * @param bool $bestOnly + * @param bool $availableOnly + */ + public function __construct($criteria, $bestOnly, $availableOnly) + { + $this->BestOnlyIndicator = $bestOnly; + $this->AvailableOnlyIndicator = $availableOnly; + + foreach ($criteria as $criterion) { + $this->Criterion[] = new Criterion($criterion); + } + } +} diff --git a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/HotelSearchCriterionType.php b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/HotelSearchCriterionType.php new file mode 100644 index 000000000..591cc4599 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/HotelSearchCriterionType.php @@ -0,0 +1,152 @@ + + */ +class HotelSearchCriterionType +{ + /** + * @var HotelAmenity[] + */ + public $HotelAmenity = []; + + /** + * @var RoomAmenity[] + */ + public $RoomAmenity = []; + + /** + * @var HotelFeature[] + */ + public $HotelFeature = []; + + /** + * @var Award[] + */ + public $Award = []; + + /** + * @var Recreation[] + */ + public $Recreation = []; + + /** + * @var Service[] + */ + public $Service = []; + + /** + * @var Transportation[] + */ + public $Transportation = []; + + /** + * @var StayDateRange + */ + public $StayDateRange; + + /** + * @var RateRange[] + */ + public $RateRange = []; + + /** + * @var RatePlanCandidates + */ + public $RatePlanCandidates; + + /** + * @var Profiles + */ + public $Profiles; + + /** + * @var RoomStayCandidates + */ + public $RoomStayCandidates; + + /** + * @var AcceptedPayments + */ + public $AcceptedPayments; + + /** + * @var Media[] + */ + public $Media = []; + + /** + * @var HotelMeetingFacility[] + */ + public $HotelMeetingFacility = []; + + /** + * @var MealPlan + */ + public $MealPlan; + + /** + * @var RebatePrograms + */ + public $RebatePrograms; + + /** + * @var UserGeneratedContent + */ + public $UserGeneratedContent; + + /** + * @var bool + */ + public $ExactMatch; + + public $ImportanceType; + + public $Ranking; + + public $Position; + + public $Address; + + public $Telephone; + + public $RefPoint = []; + + public $CodeRef; + + /** + * @var HotelRef[] + */ + public $HotelRef = []; + + public $Radius; + + public $MapArea; + + public $AdditionalContents; +} diff --git a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/ItemSearchCriterionType.php b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/ItemSearchCriterionType.php new file mode 100644 index 000000000..dd0ac2a4f --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/ItemSearchCriterionType.php @@ -0,0 +1,64 @@ + + */ +class ItemSearchCriterionType +{ + /** + * @var bool + */ + public $ExactMatch; + + public $ImportanceType; + + public $Ranking; + + public $Position; + + public $Address; + + public $Telephone; + + public $RefPoint = []; + + public $CodeRef; + + /** + * @var HotelRef[] + */ + public $HotelRef = []; + + public $Radius; + + public $MapArea; + + public $AdditionalContents; + + +} diff --git a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/MealPlan.php b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/MealPlan.php new file mode 100644 index 000000000..5570d0074 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/MealPlan.php @@ -0,0 +1,33 @@ + + */ +class MealPlan +{ +} diff --git a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Media.php b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Media.php new file mode 100644 index 000000000..36afca234 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Media.php @@ -0,0 +1,33 @@ + + */ +class Media +{ +} diff --git a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/PosType.php b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/PosType.php new file mode 100644 index 000000000..c1aada7ab --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/PosType.php @@ -0,0 +1,37 @@ + + */ +class PosType +{ + /** + * @var mixed[] + */ + public $Source = []; +} diff --git a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Profiles.php b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Profiles.php new file mode 100644 index 000000000..a5dd5f890 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Profiles.php @@ -0,0 +1,33 @@ + + */ +class Profiles +{ +} diff --git a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/RatePlanCandidates.php b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/RatePlanCandidates.php new file mode 100644 index 000000000..6b6384fab --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/RatePlanCandidates.php @@ -0,0 +1,33 @@ + + */ +class RatePlanCandidates +{ +} diff --git a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/RateRange.php b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/RateRange.php new file mode 100644 index 000000000..ee623c561 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/RateRange.php @@ -0,0 +1,88 @@ + + */ +class RateRange +{ + const TIMEUNIT_YEAR = "Year"; + const TIMEUNIT_MONTH = "Month"; + const TIMEUNIT_WEEK = "Week"; + const TIMEUNIT_DAY = "Day"; + const TIMEUNIT_HOUR = "Hour"; + const TIMEUNIT_SECOND = "Second"; + const TIMEUNIT_FULL_DURATION = "FullDuration"; + const TIMEUNIT_MINUTE = "Minute"; + + /** + * @var double|string + */ + public $MinRate; + + /** + * @var double|string + */ + public $MaxRate; + + /** + * @var double|string + */ + public $FixedRate; + + /** + * self::TIMEUNIT_* + * + * @var string + */ + public $RateTimeUnit; + + /** + * @var string + */ + public $CurrencyCode; + + /** + * @var int + */ + public $DecimalPlaces; + + /** + * RateRange constructor. + * + * @param Rates $rates + */ + public function __construct(Rates $rates) + { + $this->MinRate = $rates->min; + $this->MaxRate = $rates->max; + $this->CurrencyCode = $rates->currency; + $this->RateTimeUnit = $rates->timeUnit; + } +} diff --git a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/RebatePrograms.php b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/RebatePrograms.php new file mode 100644 index 000000000..b382b21b0 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/RebatePrograms.php @@ -0,0 +1,33 @@ + + */ +class RebatePrograms +{ +} diff --git a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Recreation.php b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Recreation.php new file mode 100644 index 000000000..449bcd587 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Recreation.php @@ -0,0 +1,33 @@ + + */ +class Recreation +{ +} diff --git a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/RoomAmenity.php b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/RoomAmenity.php new file mode 100644 index 000000000..64d8e0ea7 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/RoomAmenity.php @@ -0,0 +1,33 @@ + + */ +class RoomAmenity +{ +} diff --git a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/RoomStayCandidate.php b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/RoomStayCandidate.php new file mode 100644 index 000000000..530b11669 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/RoomStayCandidate.php @@ -0,0 +1,62 @@ + + */ +class RoomStayCandidate +{ + /** + * @var int + */ + public $RoomID; + + /** + * @var int + */ + public $Quantity; + + /** + * @var GuestCounts + */ + public $GuestCounts; + + /** + * RoomStayCandidate constructor. + * + * @param Room $room + */ + public function __construct(Room $room) + { + $this->RoomID = $room->id; + $this->Quantity = $room->amount; + + $this->GuestCounts = new GuestCounts($room->guestsIsPerRoom, $room->guests); + } +} diff --git a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/RoomStayCandidates.php b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/RoomStayCandidates.php new file mode 100644 index 000000000..765f54972 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/RoomStayCandidates.php @@ -0,0 +1,37 @@ + + */ +class RoomStayCandidates +{ + /** + * @var RoomStayCandidate[] + */ + public $RoomStayCandidate = []; +} diff --git a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Service.php b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Service.php new file mode 100644 index 000000000..c50cbc483 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Service.php @@ -0,0 +1,33 @@ + + */ +class Service +{ +} diff --git a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/StayDateRange.php b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/StayDateRange.php new file mode 100644 index 000000000..298540a38 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/StayDateRange.php @@ -0,0 +1,82 @@ + + */ +class StayDateRange extends WsMessageUtility +{ + /** + * yyyy-mm-dd + * + * @var string + */ + public $Start; + + /** + * @var string + */ + public $Duration; + + /** + * yyyy-mm-dd + * + * @var string + */ + public $End; + + /** + * StayDateRange constructor. + * + * @param \DateTime $start + * @param \DateTime $end + */ + public function __construct($start, $end) + { + $this->Start = $this->makeDateString($start); + $this->End = $this->makeDateString($end); + } + + /** + * yyyy-mm-dd + * + * @param \DateTime|null $date + * @return string + */ + protected function makeDateString($date) + { + $dateStr = '0000-00-00'; + + if ($date instanceof \DateTime) { + $dateStr = $date->format('Y-m-d'); + } + + return $dateStr; + } +} diff --git a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Transportation.php b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Transportation.php new file mode 100644 index 000000000..de7a12348 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Transportation.php @@ -0,0 +1,33 @@ + + */ +class Transportation +{ +} diff --git a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/UserGeneratedContent.php b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/UserGeneratedContent.php new file mode 100644 index 000000000..63769501b --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/UserGeneratedContent.php @@ -0,0 +1,33 @@ + + */ +class UserGeneratedContent +{ +} diff --git a/src/Amadeus/Client/Struct/Hotel/Sell.php b/src/Amadeus/Client/Struct/Hotel/Sell.php new file mode 100644 index 000000000..1a7b167c4 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/Sell.php @@ -0,0 +1,99 @@ + + */ +class Sell extends BaseWsMessage +{ + /** + * @var SystemIdentifier + */ + public $systemIdentifier; + + /** + * @var BookingCompany[] + */ + public $bookingCompany = []; + + /** + * @var ReservationInfo + */ + public $reservationInfo; + + /** + * @var ExtraIndentification + */ + public $extraIndentification; + + /** + * @var GroupIndicator + */ + public $groupIndicator; + + /** + * @var TravelAgentRef[] + */ + public $travelAgentRef = []; + + /** + * @var BookingPayerDetails + */ + public $bookingPayerDetails; + + /** + * @var RoomStayData[] + */ + public $roomStayData = []; + + /** + * @var ArrivalFlightDetailsGrp + */ + public $arrivalFlightDetailsGrp; + + /** + * Hotel_Sell constructor. + * + * @param HotelSellOptions $options + */ + public function __construct(HotelSellOptions $options) + { + //TODO + } +} diff --git a/src/Amadeus/Client/Struct/Hotel/Sell/AddressDetails.php b/src/Amadeus/Client/Struct/Hotel/Sell/AddressDetails.php new file mode 100644 index 000000000..65aaf31a3 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/Sell/AddressDetails.php @@ -0,0 +1,62 @@ + + */ +class AddressDetails +{ + /** + * @var string + */ + public $format; + + /** + * @var string + */ + public $line1; + + /** + * @var string + */ + public $line2; + + /** + * @var string + */ + public $line3; + + /** + * @var string + */ + public $line4; + + /** + * @var string + */ + public $line5; +} diff --git a/src/Amadeus/Client/Struct/Hotel/Sell/ArrivalFlightDetailsData.php b/src/Amadeus/Client/Struct/Hotel/Sell/ArrivalFlightDetailsData.php new file mode 100644 index 000000000..d1208a0b1 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/Sell/ArrivalFlightDetailsData.php @@ -0,0 +1,34 @@ + + */ +class ArrivalFlightDetailsData +{ + //TODO +} diff --git a/src/Amadeus/Client/Struct/Hotel/Sell/ArrivalFlightDetailsGrp.php b/src/Amadeus/Client/Struct/Hotel/Sell/ArrivalFlightDetailsGrp.php new file mode 100644 index 000000000..056c521e2 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/Sell/ArrivalFlightDetailsGrp.php @@ -0,0 +1,42 @@ + + */ +class ArrivalFlightDetailsGrp +{ + /** + * @var ArrivalFlightDetailsTag + */ + public $arrivalFlightDetailsTag; + + /** + * @var ArrivalFlightDetailsData + */ + public $arrivalFlightDetailsData; +} diff --git a/src/Amadeus/Client/Struct/Hotel/Sell/ArrivalFlightDetailsTag.php b/src/Amadeus/Client/Struct/Hotel/Sell/ArrivalFlightDetailsTag.php new file mode 100644 index 000000000..241565ccf --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/Sell/ArrivalFlightDetailsTag.php @@ -0,0 +1,34 @@ + + */ +class ArrivalFlightDetailsTag +{ + //TODO +} diff --git a/src/Amadeus/Client/Struct/Hotel/Sell/AttributeDetails.php b/src/Amadeus/Client/Struct/Hotel/Sell/AttributeDetails.php new file mode 100644 index 000000000..82803ad31 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/Sell/AttributeDetails.php @@ -0,0 +1,54 @@ + + */ +class AttributeDetails +{ + const TYPE_BRAND = "BRA"; + const TYPE_CORPORATION_NAME = "CORP"; + const TYPE_SUB_BRAND = "SBR"; + const TYPE_SUB_SUB_BRAND = "SSB"; + + /** + * self::TYPE_* + * + * @var string + */ + public $attributeType; + + /** + * AttributeDetails constructor. + * + * @param string $attributeType + */ + public function __construct($attributeType) + { + $this->attributeType = $attributeType; + } +} diff --git a/src/Amadeus/Client/Struct/Hotel/Sell/BookerAddress.php b/src/Amadeus/Client/Struct/Hotel/Sell/BookerAddress.php new file mode 100644 index 000000000..75e248775 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/Sell/BookerAddress.php @@ -0,0 +1,62 @@ + + */ +class BookerAddress +{ + /** + * @var AddressDetails + */ + public $addressDetails; + + /** + * @var string + */ + public $city; + + /** + * @var string + */ + public $zipCode; + + /** + * @var string + */ + public $countryCode; + + /** + * @var LocationDetails + */ + public $regionDetails; + + /** + * @var LocationDetails + */ + public $locationDetails; +} diff --git a/src/Amadeus/Client/Struct/Hotel/Sell/BookerName.php b/src/Amadeus/Client/Struct/Hotel/Sell/BookerName.php new file mode 100644 index 000000000..fedb7b90e --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/Sell/BookerName.php @@ -0,0 +1,42 @@ + + */ +class BookerName +{ + /** + * @var TravellerNameInfo + */ + public $travellerNameInfo; + + /** + * @var OtherPaxNamesDetails + */ + public $otherPaxNamesDetails; +} diff --git a/src/Amadeus/Client/Struct/Hotel/Sell/BookingCompany.php b/src/Amadeus/Client/Struct/Hotel/Sell/BookingCompany.php new file mode 100644 index 000000000..c26e5e7d5 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/Sell/BookingCompany.php @@ -0,0 +1,59 @@ + + */ +class BookingCompany +{ + /** + * @var CompanyQualifier + */ + public $companyQualifier; + + /** + * @var CompanyName + */ + public $companyName; + + /** + * BookingCompany constructor. + * + * @param string|null $company Company name + * @param string|null $type AttributeDetails::TYPE_* + */ + public function __construct($company = null, $type = null) + { + if (!is_null($company)) { + $this->companyName = new CompanyName($company); + } + + if (!is_null($type)) { + $this->companyQualifier = new CompanyQualifier($type); + } + } +} diff --git a/src/Amadeus/Client/Struct/Hotel/Sell/BookingPayer.php b/src/Amadeus/Client/Struct/Hotel/Sell/BookingPayer.php new file mode 100644 index 000000000..dcfe07244 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/Sell/BookingPayer.php @@ -0,0 +1,37 @@ + + */ +class BookingPayer +{ + /** + * @var PassengerReference + */ + public $passengerReference; +} diff --git a/src/Amadeus/Client/Struct/Hotel/Sell/BookingPayerDetails.php b/src/Amadeus/Client/Struct/Hotel/Sell/BookingPayerDetails.php new file mode 100644 index 000000000..842b203d7 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/Sell/BookingPayerDetails.php @@ -0,0 +1,62 @@ + + */ +class BookingPayerDetails +{ + /** + * @var BookerName + */ + public $bookerName; + + /** + * @var BookingPayer + */ + public $bookingPayer; + + /** + * @var GuestContactInfo + */ + public $guestContactInfo; + + /** + * @var OccupantPreferences + */ + public $occupantPreferences; + + /** + * @var OccupantPersonalInformation + */ + public $occupantPersonalInformation; + + /** + * @var BookerAddress + */ + public $bookerAddress; +} diff --git a/src/Amadeus/Client/Struct/Hotel/Sell/CompanyName.php b/src/Amadeus/Client/Struct/Hotel/Sell/CompanyName.php new file mode 100644 index 000000000..74da89d17 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/Sell/CompanyName.php @@ -0,0 +1,47 @@ + + */ +class CompanyName +{ + /** + * @var string + */ + public $companyName; + + /** + * CompanyName constructor. + * + * @param string $companyName + */ + public function __construct($companyName) + { + $this->companyName = $companyName; + } +} diff --git a/src/Amadeus/Client/Struct/Hotel/Sell/CompanyQualifier.php b/src/Amadeus/Client/Struct/Hotel/Sell/CompanyQualifier.php new file mode 100644 index 000000000..d75f9b7af --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/Sell/CompanyQualifier.php @@ -0,0 +1,47 @@ + + */ +class CompanyQualifier +{ + /** + * @var AttributeDetails[] + */ + public $attributeDetails = []; + + /** + * CompanyQualifier constructor. + * + * @param string $companyQualifier AttributeDetails::TYPE_* + */ + public function __construct($companyQualifier) + { + $this->attributeDetails[] = new AttributeDetails($companyQualifier); + } +} diff --git a/src/Amadeus/Client/Struct/Hotel/Sell/DeliveringSystem.php b/src/Amadeus/Client/Struct/Hotel/Sell/DeliveringSystem.php new file mode 100644 index 000000000..3b65f33e9 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/Sell/DeliveringSystem.php @@ -0,0 +1,57 @@ + + */ +class DeliveringSystem +{ + const COMPANY_ERETAIL = "AERE"; + const COMPANY_ETRAVEL_MANAGEMENT = "AETM"; + const COMPANY_COMMAND_PAGE = "COMM"; + const COMPANY_SELL2_SELL_CONNECT = "SECO"; + const COMPANY_SELLING_PLATFORM_CLASSIC = "SELL"; + const COMPANY_NON_SPECIFIC_PRODUCT_FROM_SEL = "SEP"; + const COMPANY_WEBSERVICES = "WEBS"; + + /** + * self::COMPANY_* + * + * @var string + */ + public $companyId; + + /** + * DeliveringSystem constructor. + * + * @param string $companyId + */ + public function __construct($companyId = self::COMPANY_WEBSERVICES) + { + $this->companyId = $companyId; + } +} diff --git a/src/Amadeus/Client/Struct/Hotel/Sell/DocumentIdentification.php b/src/Amadeus/Client/Struct/Hotel/Sell/DocumentIdentification.php new file mode 100644 index 000000000..781587e12 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/Sell/DocumentIdentification.php @@ -0,0 +1,67 @@ + + */ +class DocumentIdentification +{ + const TYPE_CEDULA_ARGENTINIAN_ID = "CED"; + /** + * NUMBER FOR BRAZILIANS AND RESIDENT ALIENS WHO PAY TAXES IN BRAZIL + */ + const TYPE_CADASTRO_DE_PESSOAS_FISICAS = "CPF"; + const TYPE_LOCAL_ID_DOCUMENT = "ID"; + const TYPE_NATIONAL_ID_CARD = "NI"; + const TYPE_OTHER_ID_DOCUMENT = "OTH"; + const TYPE_PASSPORT = "PT"; + const TYPE_VISA = "VI"; + + /** + * self::TYPE_* + * + * @var string + */ + public $type; + + /** + * @var string + */ + public $number; + + /** + * DocumentIdentification constructor. + * + * @param string $number + * @param string $type + */ + public function __construct($number, $type) + { + $this->type = $type; + $this->number = $number; + } +} diff --git a/src/Amadeus/Client/Struct/Hotel/Sell/ExtraIndentification.php b/src/Amadeus/Client/Struct/Hotel/Sell/ExtraIndentification.php new file mode 100644 index 000000000..2b0db8440 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/Sell/ExtraIndentification.php @@ -0,0 +1,37 @@ + + */ +class ExtraIndentification +{ + /** + * @var ReferenceDetails[] + */ + public $referenceDetails = []; +} diff --git a/src/Amadeus/Client/Struct/Hotel/Sell/GroupIndicator.php b/src/Amadeus/Client/Struct/Hotel/Sell/GroupIndicator.php new file mode 100644 index 000000000..2b9dc4e2e --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/Sell/GroupIndicator.php @@ -0,0 +1,48 @@ + + */ +class GroupIndicator +{ + /** + * @var StatusDetails[] + */ + public $statusDetails = []; + + /** + * GroupIndicator constructor. + * + * @param string $indicator StatusDetails::INDICATOR_* + * @param int|string $action StatusDetails::ACTION_* + */ + public function __construct($indicator, $action) + { + $this->statusDetails[] = new StatusDetails($indicator, $action); + } +} diff --git a/src/Amadeus/Client/Struct/Hotel/Sell/GuestContactInfo.php b/src/Amadeus/Client/Struct/Hotel/Sell/GuestContactInfo.php new file mode 100644 index 000000000..e968304f9 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/Sell/GuestContactInfo.php @@ -0,0 +1,53 @@ + + */ +class GuestContactInfo +{ + const TYPE_EMAIL = "EML"; + /** + * @var string + */ + public $phoneOrEmailType = self::TYPE_EMAIL; + + /** + * @var string + */ + public $emailAddress; + + /** + * GuestContactInfo constructor. + * + * @param string $emailAddress + */ + public function __construct($emailAddress) + { + $this->emailAddress = $emailAddress; + } +} diff --git a/src/Amadeus/Client/Struct/Hotel/Sell/LocationDetails.php b/src/Amadeus/Client/Struct/Hotel/Sell/LocationDetails.php new file mode 100644 index 000000000..031747e9e --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/Sell/LocationDetails.php @@ -0,0 +1,47 @@ + + */ +class LocationDetails +{ + /** + * @var string + */ + public $name; + + /** + * LocationDetails constructor. + * + * @param string $name + */ + public function __construct($name) + { + $this->name = $name; + } +} diff --git a/src/Amadeus/Client/Struct/Hotel/Sell/OccupantPersonalInformation.php b/src/Amadeus/Client/Struct/Hotel/Sell/OccupantPersonalInformation.php new file mode 100644 index 000000000..e43572886 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/Sell/OccupantPersonalInformation.php @@ -0,0 +1,47 @@ + + */ +class OccupantPersonalInformation +{ + const GENDER_FEMALE = "F"; + const GENDER_MALE = "M"; + + /** + * self::GENDER_* + * + * @var string + */ + public $regulatoryGender; + + /** + * @var DocumentIdentification + */ + public $documentIdentification; +} diff --git a/src/Amadeus/Client/Struct/Hotel/Sell/OccupantPreferences.php b/src/Amadeus/Client/Struct/Hotel/Sell/OccupantPreferences.php new file mode 100644 index 000000000..b4f082641 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/Sell/OccupantPreferences.php @@ -0,0 +1,37 @@ + + */ +class OccupantPreferences +{ + /** + * @var UserPreferences + */ + public $userPreferences; +} diff --git a/src/Amadeus/Client/Struct/Hotel/Sell/OtherPaxNamesDetails.php b/src/Amadeus/Client/Struct/Hotel/Sell/OtherPaxNamesDetails.php new file mode 100644 index 000000000..5eaebc26a --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/Sell/OtherPaxNamesDetails.php @@ -0,0 +1,61 @@ + + */ +class OtherPaxNamesDetails +{ + /** + * @var string + */ + public $surname; + + /** + * @var string + */ + public $givenName; + + /** + * @var string + */ + public $title; + + /** + * OtherPaxNamesDetails constructor. + * + * @param string $surname + * @param string $givenName + * @param string|null $title + */ + public function __construct($surname, $givenName, $title = null) + { + $this->surname = $surname; + $this->givenName = $givenName; + $this->title = $title; + } +} diff --git a/src/Amadeus/Client/Struct/Hotel/Sell/PassengerReference.php b/src/Amadeus/Client/Struct/Hotel/Sell/PassengerReference.php new file mode 100644 index 000000000..957c93aa0 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/Sell/PassengerReference.php @@ -0,0 +1,59 @@ + + */ +class PassengerReference +{ + const TYPE_BOOKING_PAYER_AND_HOLDER_NON_OCCUPANT = "BHN"; + const TYPE_BOOKING_PAYER_AND_HOLDER_OCCUPANT = "BHO"; + const TYPE_BOOKING_PAYER_NON_OCCUPANT = "BPN"; + const TYPE_BOOKING_PAYER_OCCUPANT = "BPO"; + + /** + * self::TYPE_* + * + * @var string + */ + public $type; + + /** + * @var int + */ + public $value; + + /** + * @param int $tattoo + * @param string $type self::TYPE_* + */ + public function __construct($tattoo, $type) + { + $this->value = $tattoo; + $this->type = $type; + } +} diff --git a/src/Amadeus/Client/Struct/Hotel/Sell/Reference.php b/src/Amadeus/Client/Struct/Hotel/Sell/Reference.php new file mode 100644 index 000000000..6a5a871fe --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/Sell/Reference.php @@ -0,0 +1,56 @@ + + */ +class Reference +{ + const TYPE_SEGMENT_TATTOO = "ST"; + + /** + * @var string + */ + public $type = self::TYPE_SEGMENT_TATTOO; + + /** + * @var int + */ + public $value; + + /** + * Reference constructor. + * + * @param int $value + * @param string $type + */ + public function __construct($value, $type = self::TYPE_SEGMENT_TATTOO) + { + $this->type = $type; + $this->value = $value; + } +} diff --git a/src/Amadeus/Client/Struct/Hotel/Sell/ReferenceDetails.php b/src/Amadeus/Client/Struct/Hotel/Sell/ReferenceDetails.php new file mode 100644 index 000000000..871b24069 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/Sell/ReferenceDetails.php @@ -0,0 +1,42 @@ + + */ +class ReferenceDetails +{ + /** + * @var string + */ + public $type; + + /** + * @var string + */ + public $value; +} diff --git a/src/Amadeus/Client/Struct/Hotel/Sell/RoomStayData.php b/src/Amadeus/Client/Struct/Hotel/Sell/RoomStayData.php new file mode 100644 index 000000000..9ddd18ea5 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/Sell/RoomStayData.php @@ -0,0 +1,33 @@ + + */ +class RoomStayData extends \Amadeus\Client\Struct\Offer\ConfirmHotel\RoomStayData +{ +} diff --git a/src/Amadeus/Client/Struct/Hotel/Sell/StatusDetails.php b/src/Amadeus/Client/Struct/Hotel/Sell/StatusDetails.php new file mode 100644 index 000000000..1619c54e1 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/Sell/StatusDetails.php @@ -0,0 +1,64 @@ + + */ +class StatusDetails +{ + const INDICATOR_GROUP_BILLING = "GB"; + const INDICATOR_GROUP_BOOKING = "GR"; + + const ACTION_YES = 1; + const ACTION_NO = 2; + + /** + * self::INDICATOR_* + * + * @var string + */ + public $indicator; + + /** + * self::ACTION_* + * + * @var string|int + */ + public $action; + + /** + * StatusDetails constructor. + * + * @param string $indicator self::INDICATOR_* + * @param int|string $action self::ACTION_* + */ + public function __construct($indicator, $action) + { + $this->indicator = $indicator; + $this->action = $action; + } +} diff --git a/src/Amadeus/Client/Struct/Hotel/Sell/SystemIdentifier.php b/src/Amadeus/Client/Struct/Hotel/Sell/SystemIdentifier.php new file mode 100644 index 000000000..ef6448d74 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/Sell/SystemIdentifier.php @@ -0,0 +1,47 @@ + + */ +class SystemIdentifier +{ + /** + * @var DeliveringSystem + */ + public $deliveringSystem; + + /** + * SystemIdentifier constructor. + * + * @param string $companyId + */ + public function __construct($companyId = DeliveringSystem::COMPANY_WEBSERVICES) + { + $this->deliveringSystem = new DeliveringSystem($companyId); + } +} diff --git a/src/Amadeus/Client/Struct/Hotel/Sell/TravelAgentRef.php b/src/Amadeus/Client/Struct/Hotel/Sell/TravelAgentRef.php new file mode 100644 index 000000000..c75599ea2 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/Sell/TravelAgentRef.php @@ -0,0 +1,60 @@ + + */ +class TravelAgentRef +{ + const REFERENCE_PHONE = "AP"; + const REFERENCE_EMAIL = "APE"; + const REFERENCE_FAX = "APF"; + + /** + * self::REFERENCE_* + * + * @var string + */ + public $status; + + /** + * @var Reference + */ + public $reference; + + /** + * TravelAgentRef constructor. + * + * @param string $status self::REFERENCE_* + * @param int $segmentTattoo + */ + public function __construct($status, $segmentTattoo) + { + $this->status = $status; + $this->reference = new Reference($segmentTattoo); + } +} diff --git a/src/Amadeus/Client/Struct/Hotel/Sell/TravellerNameInfo.php b/src/Amadeus/Client/Struct/Hotel/Sell/TravellerNameInfo.php new file mode 100644 index 000000000..e45c704cc --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/Sell/TravellerNameInfo.php @@ -0,0 +1,53 @@ + + */ +class TravellerNameInfo +{ + /** + * @var int + */ + public $quantity; + + /** + * @var int + */ + public $age; + + /** + * TravellerNameInfo constructor. + * + * @param int $quantity + * @param int|null $age + */ + public function __construct($quantity, $age = null) + { + $this->quantity = $quantity; + } +} diff --git a/src/Amadeus/Client/Struct/Hotel/Sell/UserPreferences.php b/src/Amadeus/Client/Struct/Hotel/Sell/UserPreferences.php new file mode 100644 index 000000000..725de4a6b --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/Sell/UserPreferences.php @@ -0,0 +1,47 @@ + + */ +class UserPreferences +{ + /** + * @var string + */ + public $codedLanguage; + + /** + * UserPreferences constructor. + * + * @param string $codedLanguage + */ + public function __construct($codedLanguage) + { + $this->codedLanguage = $codedLanguage; + } +} diff --git a/src/Amadeus/Client/Struct/Pnr/NameChange/OtherPaxNamesDetails.php b/src/Amadeus/Client/Struct/Pnr/NameChange/OtherPaxNamesDetails.php index 54af579bd..e1ce2ba9d 100644 --- a/src/Amadeus/Client/Struct/Pnr/NameChange/OtherPaxNamesDetails.php +++ b/src/Amadeus/Client/Struct/Pnr/NameChange/OtherPaxNamesDetails.php @@ -22,13 +22,15 @@ namespace Amadeus\Client\Struct\Pnr\NameChange; +use Amadeus\Client\Struct\Hotel\Sell\OtherPaxNamesDetails as HotelSellPND; + /** * OtherPaxNamesDetails * * @package Amadeus\Client\Struct\Pnr\NameChange * @author Dieter Devlieghere */ -class OtherPaxNamesDetails +class OtherPaxNamesDetails extends HotelSellPND { /** * NN1 Romanizable Native Name @@ -46,33 +48,4 @@ class OtherPaxNamesDetails * @var string */ public $referenceName; - - /** - * @var string - */ - public $surname; - - /** - * @var string - */ - public $givenName; - - /** - * @var string - */ - public $title; - - /** - * OtherPaxNamesDetails constructor. - * - * @param string $surname - * @param string $givenName - * @param string|null $title - */ - public function __construct($surname, $givenName, $title = null) - { - $this->surname = $surname; - $this->givenName = $givenName; - $this->title = $title; - } } diff --git a/src/Amadeus/Client/Struct/Pnr/NameChange/TravellerNameInfo.php b/src/Amadeus/Client/Struct/Pnr/NameChange/TravellerNameInfo.php index d37b731d7..3c52e4ed9 100644 --- a/src/Amadeus/Client/Struct/Pnr/NameChange/TravellerNameInfo.php +++ b/src/Amadeus/Client/Struct/Pnr/NameChange/TravellerNameInfo.php @@ -31,7 +31,7 @@ class TravellerNameInfo { /** - * @var string|string + * @var string|int */ public $quantity; diff --git a/tests/Amadeus/Client/ResponseHandler/BaseTest.php b/tests/Amadeus/Client/ResponseHandler/BaseTest.php index 23311d0bc..03aa96282 100644 --- a/tests/Amadeus/Client/ResponseHandler/BaseTest.php +++ b/tests/Amadeus/Client/ResponseHandler/BaseTest.php @@ -741,6 +741,26 @@ public function testCanHandleOfferCreateOfferOk() $this->assertEquals(0, count($result->messages)); } + public function testCanHandleHotelMultiSingleAvailabilityErr() + { + $respHandler = new ResponseHandler\Base(); + + $sendResult = new SendResult(); + $sendResult->responseXml = $this->getTestFile('dummyHotelMultiSingleAvailabilityErrorResponse.txt'); + $sendResult->messageVersion = '10.0'; + + $this->markTestIncomplete('Still need a proper example of an error response'); + + $result = $respHandler->analyzeResponse($sendResult, 'Hotel_MultiSingleAvailability'); + + $this->assertEquals(Result::STATUS_ERROR, $result->status); + $this->assertEquals(1, count($result->messages)); + $this->assertNull($result->messages[0]->text); + $this->assertEquals('', $result->messages[0]->level); + $this->assertEquals('367', $result->messages[0]->code); + $this->assertEquals('1A', $result->messages[0]->source); + } + public function testCanHandleSoapFault() { $respHandler = new ResponseHandler\Base(); diff --git a/tests/Amadeus/Client/ResponseHandler/testfiles/dummyHotelMultiSingleAvailabilityErrorResponse.txt b/tests/Amadeus/Client/ResponseHandler/testfiles/dummyHotelMultiSingleAvailabilityErrorResponse.txt new file mode 100644 index 000000000..9a5ac7eb3 --- /dev/null +++ b/tests/Amadeus/Client/ResponseHandler/testfiles/dummyHotelMultiSingleAvailabilityErrorResponse.txt @@ -0,0 +1,5 @@ + + + + + diff --git a/tests/Amadeus/Client/ResponseHandler/testfiles/dummyHotelMultiSingleAvailabilityWarningResponse.txt b/tests/Amadeus/Client/ResponseHandler/testfiles/dummyHotelMultiSingleAvailabilityWarningResponse.txt new file mode 100644 index 000000000..cffd7d256 --- /dev/null +++ b/tests/Amadeus/Client/ResponseHandler/testfiles/dummyHotelMultiSingleAvailabilityWarningResponse.txt @@ -0,0 +1,6 @@ + + + + + + diff --git a/tests/Amadeus/Client/ResponseHandler/testfiles/dummyHotelSellReplyErrorResponse.txt b/tests/Amadeus/Client/ResponseHandler/testfiles/dummyHotelSellReplyErrorResponse.txt new file mode 100644 index 000000000..f6cfe2457 --- /dev/null +++ b/tests/Amadeus/Client/ResponseHandler/testfiles/dummyHotelSellReplyErrorResponse.txt @@ -0,0 +1,31 @@ + + + + 1 + HK + + + + + + + + 00704 + EC + PR + + + + + 3 + HERR + EN + S + 1 + + INVALID DATE RANGE + + + + + diff --git a/tests/Amadeus/Client/Session/MsgClassmap/LoaderTest.php b/tests/Amadeus/Client/Session/MsgClassmap/LoaderTest.php new file mode 100644 index 000000000..e8820b17f --- /dev/null +++ b/tests/Amadeus/Client/Session/MsgClassmap/LoaderTest.php @@ -0,0 +1,50 @@ + + */ +class LoaderTest extends BaseTestCase +{ + public function testCanLoadHotelMultiSingleClassmap() + { + $msgAndVer = [ + 'PNR_Retrieve' => '14.2', + 'Hotel_MultiSingleAvailability' => '10.0' + ]; + + $classmap = Loader::loadMessagesSpecificClasses($msgAndVer); + + $expected = LoaderMultiSingleAvailability::loadClassMapForMessage('10.0'); + + $this->assertEquals($expected, $classmap); + } +} diff --git a/tests/Amadeus/Client/Struct/Hotel/HotelMultiSingleAvailabilityTest.php b/tests/Amadeus/Client/Struct/Hotel/HotelMultiSingleAvailabilityTest.php new file mode 100644 index 000000000..703b3896f --- /dev/null +++ b/tests/Amadeus/Client/Struct/Hotel/HotelMultiSingleAvailabilityTest.php @@ -0,0 +1,102 @@ + + */ +class HotelMultiSingleAvailabilityTest extends BaseTestCase +{ + public function testCanMakeMessage() + { + $opt = new HotelMultiSingleAvailOptions([ + 'segments' => [ + new Segment([ + 'infoSource' => Segment::SOURCE_DISTRIBUTION, + 'criteria' => [ + new Criteria([ + 'exactMatch' => true, + 'stayStart' => \DateTime::createFromFormat('Y-m-d', '2017-12-28'), + 'stayEnd' => \DateTime::createFromFormat('Y-m-d', '2017-12-29'), + 'hotelReferences' => [ + new HotelReference([ + 'chainCode' => 'RT', + 'cityCode' => 'VIE', + 'name' => 'SOFITEL VIENNA' + ]) + ], + 'rates' => [ + new Rates([ + 'min' => 100.0, + 'max' => 400.0, + 'timeUnit' => Rates::TIMEUNIT_DAY + ]) + ], + 'rooms' => [ + new Room([ + 'id' => 1, + 'amount' => 1, + 'guests' => [ + new Guest([ + 'occupantCode' => Guest::OCCUPANT_ADULT, + 'amount' => 1 + ]) + ] + ]) + ] + ]) + ] + ]) + ] + ]); + + $msg = new MultiSingleAvailability($opt); + + $this->assertEquals('MultiSingle', $msg->EchoToken); + $this->assertEquals('4.000', $msg->Version); + $this->assertTrue($msg->SummaryOnly); + $this->assertTrue($msg->RateRangeOnly); + $this->assertTrue($msg->RateDetailsInd); + + $this->assertCount(1, $msg->AvailRequestSegments->AvailRequestSegment); + $this->assertEquals('Distribution', $msg->AvailRequestSegments->AvailRequestSegment[0]->InfoSource); + + $this->assertCount(1, $msg->AvailRequestSegments->AvailRequestSegment[0]->HotelSearchCriteria->Criterion); + $this->assertTrue($msg->AvailRequestSegments->AvailRequestSegment[0]->HotelSearchCriteria->Criterion[0]->ExactMatch); + $this->assertCount(1, $msg->AvailRequestSegments->AvailRequestSegment[0]->HotelSearchCriteria->Criterion[0]->HotelRef); + $this->assertEquals('RT', $msg->AvailRequestSegments->AvailRequestSegment[0]->HotelSearchCriteria->Criterion[0]->HotelRef[0]->ChainCode); + } +} diff --git a/tests/Amadeus/ClientTest.php b/tests/Amadeus/ClientTest.php index 61efc0a3b..2f753b934 100644 --- a/tests/Amadeus/ClientTest.php +++ b/tests/Amadeus/ClientTest.php @@ -3536,6 +3536,52 @@ public function testCanSendFopCreateFormOfPayment() $this->assertEquals($messageResult, $response); } + public function testCanSendHotelMultiSingleAvailability() + { + $mockSessionHandler = $this->getMockBuilder('Amadeus\Client\Session\Handler\HandlerInterface')->getMock(); + + $mockedSendResult = new Client\Session\Handler\SendResult(); + $mockedSendResult->responseXml = $this->getTestFile('hotelMultiSingleAvailabilityReply100.txt'); + + $messageResult = new Client\Result($mockedSendResult); + + $expectedMessageResult = new Client\Struct\Hotel\MultiSingleAvailability( + new Client\RequestOptions\HotelMultiSingleAvailOptions([ + + ]) + ); + + $mockSessionHandler + ->expects($this->once()) + ->method('sendMessage') + ->with('Hotel_MultiSingleAvailability', $expectedMessageResult, ['endSession' => false, 'returnXml' => true]) + ->will($this->returnValue($mockedSendResult));; + $mockSessionHandler + ->expects($this->never()) + ->method('getLastResponse'); + $mockSessionHandler + ->expects($this->once()) + ->method('getMessagesAndVersions') + ->will($this->returnValue(['Hotel_MultiSingleAvailability' => "10.0"])); + + $par = new Params(); + $par->sessionHandler = $mockSessionHandler; + $par->requestCreatorParams = new Params\RequestCreatorParams([ + 'receivedFrom' => 'some RF string', + 'originatorOfficeId' => 'BRUXXXXXX' + ]); + + $client = new Client($par); + + + $response = $client->hotelMultiSingleAvailability( + new Client\RequestOptions\HotelMultiSingleAvailOptions([ + ]) + ); + + $this->assertEquals($messageResult, $response); + } + public function testCanDoSignOutCall() { $mockedSendResult = new Client\Session\Handler\SendResult(); diff --git a/tests/Amadeus/testfiles/hotelMultiSingleAvailabilityReply100.txt b/tests/Amadeus/testfiles/hotelMultiSingleAvailabilityReply100.txt new file mode 100644 index 000000000..f3ac64312 --- /dev/null +++ b/tests/Amadeus/testfiles/hotelMultiSingleAvailabilityReply100.txt @@ -0,0 +1,214 @@ + + + + + + + + + +
+ PRATERSTRASSE 1 + VIENNA + 1020 + +
+ + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Advance Purchase Rate + SUPERIOR ROOM, queen-size bed, view of the Ferr + is wheel + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Smart Rate + SUPERIOR ROOM, queen-size bed, view of the Ferr + is wheel + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Advance Purchase Rate + LUXURY ROOM, one king-size bed, overlooking St. + Stephen's Cathedral + + + + + + + + + + + + + + + + + + + +