From b2e883ef1196ddbbb8f6019d6793dadd545f3696 Mon Sep 17 00:00:00 2001 From: dieter Date: Fri, 16 Dec 2016 12:23:49 +0100 Subject: [PATCH 01/14] Support for currency conversion in MasterPricerTravelBoardSearch (issue #35) --- docs/samples/masterpricertravelboard.rst | 33 ++++++++++++++ .../Converter/Fare/CheckRulesConv.php | 1 - .../FareMasterPricerTbSearch.php | 13 ++++++ .../Fare/MasterPricer/ConversionRate.php | 12 ++++++ .../MasterPricer/ConversionRateDetail.php | 10 +++++ .../Struct/Fare/MasterPricer/FareOptions.php | 43 ++++++++++++++++--- .../Fare/MasterPricer/PricingTicketing.php | 1 + .../Fare/MasterPricerTravelBoardSearch.php | 5 ++- .../MasterPricerTravelBoardSearchTest.php | 32 ++++++++++++++ 9 files changed, 141 insertions(+), 9 deletions(-) diff --git a/docs/samples/masterpricertravelboard.rst b/docs/samples/masterpricertravelboard.rst index 84ee0716b..2e87fdf02 100644 --- a/docs/samples/masterpricertravelboard.rst +++ b/docs/samples/masterpricertravelboard.rst @@ -58,6 +58,39 @@ Maximum 30 recommendations: ] ]); +Currency conversion +=================== + +Convert all price amounts for recommendations to 'USD': + +.. code-block:: php + + use Amadeus\Client\RequestOptions\FareMasterPricerTbSearch; + use Amadeus\Client\RequestOptions\Fare\MPItinerary; + use Amadeus\Client\RequestOptions\Fare\MPLocation; + use Amadeus\Client\RequestOptionsFare\MPPassenger; + use Amadeus\Client\RequestOptionsFare\MPDate; + + $opt = new FareMasterPricerTbSearch([ + 'nrOfRequestedPassengers' => 1, + 'passengers' => [ + new MPPassenger([ + 'type' => MPPassenger::TYPE_ADULT, + 'count' => 1 + ]) + ], + 'itinerary' => [ + new MPItinerary([ + 'departureLocation' => new MPLocation(['city' => 'BRU']), + 'arrivalLocation' => new MPLocation(['city' => 'LON']), + 'date' => new MPDate([ + 'dateTime' => new \DateTime('2017-01-15T00:00:00+0000', new \DateTimeZone('UTC')) + ]) + ]) + ], + 'currencyOverride' => 'USD' + ]); + One-way flight with flight types option ======================================= diff --git a/src/Amadeus/Client/RequestCreator/Converter/Fare/CheckRulesConv.php b/src/Amadeus/Client/RequestCreator/Converter/Fare/CheckRulesConv.php index a916c3278..98f287f03 100644 --- a/src/Amadeus/Client/RequestCreator/Converter/Fare/CheckRulesConv.php +++ b/src/Amadeus/Client/RequestCreator/Converter/Fare/CheckRulesConv.php @@ -24,7 +24,6 @@ use Amadeus\Client\RequestCreator\Converter\BaseConverter; use Amadeus\Client\RequestOptions\FareCheckRulesOptions; -use Amadeus\Client\RequestOptions\FareMasterPricerCalendarOptions; use Amadeus\Client\Struct; /** diff --git a/src/Amadeus/Client/RequestOptions/FareMasterPricerTbSearch.php b/src/Amadeus/Client/RequestOptions/FareMasterPricerTbSearch.php index de8f645b8..ef8d232ac 100644 --- a/src/Amadeus/Client/RequestOptions/FareMasterPricerTbSearch.php +++ b/src/Amadeus/Client/RequestOptions/FareMasterPricerTbSearch.php @@ -141,6 +141,19 @@ class FareMasterPricerTbSearch extends Base */ public $corporateCodesUnifares = []; + /** + * The currency to convert to. + * + * All price amounts for recommendations will be converted in the requested Currency. + * + * (The provided currency must be a valid 3-character ISO 4217 Currency Code) + * + * for example: EUR, USD, JPY,... + * + * @var string + */ + public $currencyOverride; + /** * Cabin class requested for the entire itinerary * diff --git a/src/Amadeus/Client/Struct/Fare/MasterPricer/ConversionRate.php b/src/Amadeus/Client/Struct/Fare/MasterPricer/ConversionRate.php index 0af9316dd..336ef0c0b 100644 --- a/src/Amadeus/Client/Struct/Fare/MasterPricer/ConversionRate.php +++ b/src/Amadeus/Client/Struct/Fare/MasterPricer/ConversionRate.php @@ -34,4 +34,16 @@ class ConversionRate * @var ConversionRateDetail[] */ public $conversionRateDetail = []; + + /** + * ConversionRate constructor. + * + * @param string|null $currency + */ + public function __construct($currency = null) + { + if (!is_null($currency)) { + $this->conversionRateDetail[] = new ConversionRateDetail($currency); + } + } } diff --git a/src/Amadeus/Client/Struct/Fare/MasterPricer/ConversionRateDetail.php b/src/Amadeus/Client/Struct/Fare/MasterPricer/ConversionRateDetail.php index 12b0b9699..0292bb07e 100644 --- a/src/Amadeus/Client/Struct/Fare/MasterPricer/ConversionRateDetail.php +++ b/src/Amadeus/Client/Struct/Fare/MasterPricer/ConversionRateDetail.php @@ -33,4 +33,14 @@ class ConversionRateDetail public $conversionType; public $currency; + + /** + * ConversionRateDetail constructor. + * + * @param $currency + */ + public function __construct($currency) + { + $this->currency = $currency; + } } diff --git a/src/Amadeus/Client/Struct/Fare/MasterPricer/FareOptions.php b/src/Amadeus/Client/Struct/Fare/MasterPricer/FareOptions.php index f6852e576..62d9942b6 100644 --- a/src/Amadeus/Client/Struct/Fare/MasterPricer/FareOptions.php +++ b/src/Amadeus/Client/Struct/Fare/MasterPricer/FareOptions.php @@ -61,23 +61,54 @@ class FareOptions * @param array $flightOptions List of flight / fare options * @param array $corpCodesUniFares list of Corporate codes for Corporate Unifares * @param bool $tickPreCheck Do Ticketability pre-check? + * @param string|null $currency Override Currency conversion */ - public function __construct(array $flightOptions, array $corpCodesUniFares, $tickPreCheck) + public function __construct(array $flightOptions, array $corpCodesUniFares, $tickPreCheck, $currency) { - $this->pricingTickInfo = new PricingTickInfo(); - $this->pricingTickInfo->pricingTicketing = new PricingTicketing(); - if ($tickPreCheck === true) { - $this->pricingTickInfo->pricingTicketing->priceType[] = PricingTicketing::PRICETYPE_TICKETABILITY_PRECHECK; + $this->addPriceType(PricingTicketing::PRICETYPE_TICKETABILITY_PRECHECK); } foreach ($flightOptions as $flightOption) { - $this->pricingTickInfo->pricingTicketing->priceType[] = $flightOption; + $this->addPriceType($flightOption); if ($flightOption === PricingTicketing::PRICETYPE_CORPORATE_UNIFARES) { $this->corporate = new Corporate(); $this->corporate->corporateId[] = new CorporateId($corpCodesUniFares); } } + + $this->loadCurrencyOverride($currency); + } + + /** + * Set currency override code if needed + * + * @param string|null $currency + */ + protected function loadCurrencyOverride($currency) + { + if (is_string($currency) && strlen($currency) === 3) { + $this->addPriceType(PricingTicketing::PRICETYPE_OVERRIDE_CURRENCY_CONVERSION); + + $this->conversionRate = new ConversionRate($currency); + } + } + + /** + * Add PriceType + * + * @param string $type + */ + protected function addPriceType($type) + { + if (is_null($this->pricingTickInfo)) { + $this->pricingTickInfo = new PricingTickInfo(); + } + if (is_null($this->pricingTickInfo->pricingTicketing)) { + $this->pricingTickInfo->pricingTicketing = new PricingTicketing(); + } + + $this->pricingTickInfo->pricingTicketing->priceType[] = $type; } } diff --git a/src/Amadeus/Client/Struct/Fare/MasterPricer/PricingTicketing.php b/src/Amadeus/Client/Struct/Fare/MasterPricer/PricingTicketing.php index ae6729b81..c81a3045b 100644 --- a/src/Amadeus/Client/Struct/Fare/MasterPricer/PricingTicketing.php +++ b/src/Amadeus/Client/Struct/Fare/MasterPricer/PricingTicketing.php @@ -45,6 +45,7 @@ class PricingTicketing const PRICETYPE_FORCE_NEUTRAL_FARE_SEARCH = "NPF"; const PRICETYPE_NO_SLICE_AND_DICE = "NSD"; const PRICETYPE_DISPLAY_MIN_MAX_STAY = "MST"; + const PRICETYPE_OVERRIDE_CURRENCY_CONVERSION = "CUC"; /** * self::PRICETYPE_* diff --git a/src/Amadeus/Client/Struct/Fare/MasterPricerTravelBoardSearch.php b/src/Amadeus/Client/Struct/Fare/MasterPricerTravelBoardSearch.php index e175f189d..c84ca9f40 100644 --- a/src/Amadeus/Client/Struct/Fare/MasterPricerTravelBoardSearch.php +++ b/src/Amadeus/Client/Struct/Fare/MasterPricerTravelBoardSearch.php @@ -141,12 +141,13 @@ protected function loadOptions($options) $this->loadNrOfPaxAndResults($options); if ($options->doTicketabilityPreCheck === true || - $this->checkAnyNotEmpty($options->corporateCodesUnifares, $options->flightOptions) + $this->checkAnyNotEmpty($options->corporateCodesUnifares, $options->flightOptions, $options->currencyOverride) ) { $this->fareOptions = new MasterPricer\FareOptions( $options->flightOptions, $options->corporateCodesUnifares, - $options->doTicketabilityPreCheck + $options->doTicketabilityPreCheck, + $options->currencyOverride ); } diff --git a/tests/Amadeus/Client/Struct/Fare/MasterPricerTravelBoardSearchTest.php b/tests/Amadeus/Client/Struct/Fare/MasterPricerTravelBoardSearchTest.php index 02a734daf..484bfb208 100644 --- a/tests/Amadeus/Client/Struct/Fare/MasterPricerTravelBoardSearchTest.php +++ b/tests/Amadeus/Client/Struct/Fare/MasterPricerTravelBoardSearchTest.php @@ -282,6 +282,38 @@ public function testCanMakeMasterPricerMessageWithTicketabilityPreCheck() $this->assertEquals(PricingTicketing::PRICETYPE_TICKETABILITY_PRECHECK, $message->fareOptions->pricingTickInfo->pricingTicketing->priceType[0]); } + public function testCanMakeMasterPricerMessageWithCurrencyOverride() + { + $opt = new FareMasterPricerTbSearch([ + 'nrOfRequestedResults' => 200, + 'nrOfRequestedPassengers' => 1, + 'passengers' => [ + new MPPassenger([ + 'type' => MPPassenger::TYPE_ADULT, + 'count' => 1 + ]) + ], + 'itinerary' => [ + new MPItinerary([ + 'departureLocation' => new MPLocation(['city' => 'BRU']), + 'arrivalLocation' => new MPLocation(['city' => 'LON']), + 'date' => new MPDate([ + 'dateTime' => new \DateTime('2017-01-15T00:00:00+0000', new \DateTimeZone('UTC')) + ]) + ]) + ], + 'currencyOverride' => 'USD' + ]); + + $message = new MasterPricerTravelBoardSearch($opt); + + $this->assertCount(1, $message->fareOptions->pricingTickInfo->pricingTicketing->priceType); + $this->assertEquals(PricingTicketing::PRICETYPE_OVERRIDE_CURRENCY_CONVERSION, $message->fareOptions->pricingTickInfo->pricingTicketing->priceType[0]); + $this->assertCount(1, $message->fareOptions->conversionRate->conversionRateDetail); + $this->assertEquals('USD', $message->fareOptions->conversionRate->conversionRateDetail[0]->currency); + $this->assertNull($message->fareOptions->conversionRate->conversionRateDetail[0]->conversionType); + } + public function testCanMakeMasterPricerMessageWithCabinClassAndCod() { $opt = new FareMasterPricerTbSearch(); From b732545bac8d38d04a90f07f66aee97ceeed8852 Mon Sep 17 00:00:00 2001 From: dieter Date: Fri, 16 Dec 2016 12:24:50 +0100 Subject: [PATCH 02/14] Beginning Hotel_Sell implementation --- CHANGELOG.md | 1 + src/Amadeus/Client.php | 14 ++++ .../Converter/Hotel/SellConv.php | 46 +++++++++++ .../RequestOptions/HotelSellOptions.php | 34 ++++++++ .../ResponseHandler/Hotel/HandlerSell.php | 45 ++++++++++ src/Amadeus/Client/Struct/Hotel/Sell.php | 82 +++++++++++++++++++ 6 files changed, 222 insertions(+) create mode 100644 src/Amadeus/Client/RequestCreator/Converter/Hotel/SellConv.php create mode 100644 src/Amadeus/Client/RequestOptions/HotelSellOptions.php create mode 100644 src/Amadeus/Client/ResponseHandler/Hotel/HandlerSell.php create mode 100644 src/Amadeus/Client/Struct/Hotel/Sell.php diff --git a/CHANGELOG.md b/CHANGELOG.md index ea931e90e..cf7291d3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ * Implemented ``DocIssuance_IssueCombined`` message * Implemented ``PNR_NameChange`` 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/src/Amadeus/Client.php b/src/Amadeus/Client.php index 684bfda7d..2f61389a8 100644 --- a/src/Amadeus/Client.php +++ b/src/Amadeus/Client.php @@ -934,6 +934,20 @@ public function docIssuanceIssueCombined( 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/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/HotelSellOptions.php b/src/Amadeus/Client/RequestOptions/HotelSellOptions.php new file mode 100644 index 000000000..b2f118837 --- /dev/null +++ b/src/Amadeus/Client/RequestOptions/HotelSellOptions.php @@ -0,0 +1,34 @@ + + */ +class HotelSellOptions extends Base +{ + +} 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/Struct/Hotel/Sell.php b/src/Amadeus/Client/Struct/Hotel/Sell.php new file mode 100644 index 000000000..9372b1318 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/Sell.php @@ -0,0 +1,82 @@ + + */ +class Sell extends BaseWsMessage +{ + /** + * @var + */ + public $systemIdentifier; + /** + * @var + */ + public $bookingCompany; + /** + * @var + */ + public $reservationInfo; + /** + * @var + */ + public $extraIndentification; + /** + * @var + */ + public $groupIndicator; + /** + * @var + */ + public $travelAgentRef; + /** + * @var + */ + public $bookingPayerDetails; + /** + * @var + */ + public $roomStayData; + /** + * @var + */ + public $arrivalFlightDetailsGrp; + + /** + * Hotel_Sell constructor. + * + * @param HotelSellOptions $options + */ + public function __construct(HotelSellOptions $options) + { + //TODO + } +} From 59ce3ba861f09c4ff71beaf00e730bae926953b3 Mon Sep 17 00:00:00 2001 From: dieter Date: Thu, 22 Dec 2016 16:20:00 +0100 Subject: [PATCH 03/14] Continuing Hotel_Sell implementation --- docs/list-of-supported-messages.rst | 2 +- docs/samples.rst | 8 +++ .../Hotel/Sell/BookingCompany.php | 53 +++++++++++++++ .../RequestOptions/HotelSellOptions.php | 24 +++++++ src/Amadeus/Client/Struct/Hotel/Sell.php | 41 ++++++++---- .../Struct/Hotel/Sell/AddressDetails.php | 62 +++++++++++++++++ .../Hotel/Sell/ArrivalFlightDetailsData.php | 34 ++++++++++ .../Hotel/Sell/ArrivalFlightDetailsGrp.php | 42 ++++++++++++ .../Hotel/Sell/ArrivalFlightDetailsTag.php | 34 ++++++++++ .../Struct/Hotel/Sell/AttributeDetails.php | 54 +++++++++++++++ .../Struct/Hotel/Sell/BookerAddress.php | 62 +++++++++++++++++ .../Client/Struct/Hotel/Sell/BookerName.php | 42 ++++++++++++ .../Struct/Hotel/Sell/BookingCompany.php | 59 ++++++++++++++++ .../Client/Struct/Hotel/Sell/BookingPayer.php | 37 ++++++++++ .../Struct/Hotel/Sell/BookingPayerDetails.php | 62 +++++++++++++++++ .../Client/Struct/Hotel/Sell/CompanyName.php | 47 +++++++++++++ .../Struct/Hotel/Sell/CompanyQualifier.php | 47 +++++++++++++ .../Struct/Hotel/Sell/DeliveringSystem.php | 57 ++++++++++++++++ .../Hotel/Sell/DocumentIdentification.php | 67 +++++++++++++++++++ .../Hotel/Sell/ExtraIndentification.php | 37 ++++++++++ .../Struct/Hotel/Sell/GroupIndicator.php | 48 +++++++++++++ .../Struct/Hotel/Sell/GuestContactInfo.php | 53 +++++++++++++++ .../Struct/Hotel/Sell/LocationDetails.php | 47 +++++++++++++ .../Sell/OccupantPersonalInformation.php | 47 +++++++++++++ .../Struct/Hotel/Sell/OccupantPreferences.php | 37 ++++++++++ .../Hotel/Sell/OtherPaxNamesDetails.php | 61 +++++++++++++++++ .../Struct/Hotel/Sell/PassengerReference.php | 59 ++++++++++++++++ .../Client/Struct/Hotel/Sell/Reference.php | 56 ++++++++++++++++ .../Struct/Hotel/Sell/ReferenceDetails.php | 42 ++++++++++++ .../Client/Struct/Hotel/Sell/RoomStayData.php | 33 +++++++++ .../Struct/Hotel/Sell/StatusDetails.php | 64 ++++++++++++++++++ .../Struct/Hotel/Sell/SystemIdentifier.php | 47 +++++++++++++ .../Struct/Hotel/Sell/TravelAgentRef.php | 60 +++++++++++++++++ .../Struct/Hotel/Sell/TravellerNameInfo.php | 53 +++++++++++++++ .../Struct/Hotel/Sell/UserPreferences.php | 47 +++++++++++++ .../Pnr/NameChange/OtherPaxNamesDetails.php | 33 +-------- .../Pnr/NameChange/TravellerNameInfo.php | 2 +- .../dummyHotelSellReplyErrorResponse.txt | 31 +++++++++ 38 files changed, 1647 insertions(+), 44 deletions(-) create mode 100644 src/Amadeus/Client/RequestOptions/Hotel/Sell/BookingCompany.php create mode 100644 src/Amadeus/Client/Struct/Hotel/Sell/AddressDetails.php create mode 100644 src/Amadeus/Client/Struct/Hotel/Sell/ArrivalFlightDetailsData.php create mode 100644 src/Amadeus/Client/Struct/Hotel/Sell/ArrivalFlightDetailsGrp.php create mode 100644 src/Amadeus/Client/Struct/Hotel/Sell/ArrivalFlightDetailsTag.php create mode 100644 src/Amadeus/Client/Struct/Hotel/Sell/AttributeDetails.php create mode 100644 src/Amadeus/Client/Struct/Hotel/Sell/BookerAddress.php create mode 100644 src/Amadeus/Client/Struct/Hotel/Sell/BookerName.php create mode 100644 src/Amadeus/Client/Struct/Hotel/Sell/BookingCompany.php create mode 100644 src/Amadeus/Client/Struct/Hotel/Sell/BookingPayer.php create mode 100644 src/Amadeus/Client/Struct/Hotel/Sell/BookingPayerDetails.php create mode 100644 src/Amadeus/Client/Struct/Hotel/Sell/CompanyName.php create mode 100644 src/Amadeus/Client/Struct/Hotel/Sell/CompanyQualifier.php create mode 100644 src/Amadeus/Client/Struct/Hotel/Sell/DeliveringSystem.php create mode 100644 src/Amadeus/Client/Struct/Hotel/Sell/DocumentIdentification.php create mode 100644 src/Amadeus/Client/Struct/Hotel/Sell/ExtraIndentification.php create mode 100644 src/Amadeus/Client/Struct/Hotel/Sell/GroupIndicator.php create mode 100644 src/Amadeus/Client/Struct/Hotel/Sell/GuestContactInfo.php create mode 100644 src/Amadeus/Client/Struct/Hotel/Sell/LocationDetails.php create mode 100644 src/Amadeus/Client/Struct/Hotel/Sell/OccupantPersonalInformation.php create mode 100644 src/Amadeus/Client/Struct/Hotel/Sell/OccupantPreferences.php create mode 100644 src/Amadeus/Client/Struct/Hotel/Sell/OtherPaxNamesDetails.php create mode 100644 src/Amadeus/Client/Struct/Hotel/Sell/PassengerReference.php create mode 100644 src/Amadeus/Client/Struct/Hotel/Sell/Reference.php create mode 100644 src/Amadeus/Client/Struct/Hotel/Sell/ReferenceDetails.php create mode 100644 src/Amadeus/Client/Struct/Hotel/Sell/RoomStayData.php create mode 100644 src/Amadeus/Client/Struct/Hotel/Sell/StatusDetails.php create mode 100644 src/Amadeus/Client/Struct/Hotel/Sell/SystemIdentifier.php create mode 100644 src/Amadeus/Client/Struct/Hotel/Sell/TravelAgentRef.php create mode 100644 src/Amadeus/Client/Struct/Hotel/Sell/TravellerNameInfo.php create mode 100644 src/Amadeus/Client/Struct/Hotel/Sell/UserPreferences.php create mode 100644 tests/Amadeus/Client/ResponseHandler/testfiles/dummyHotelSellReplyErrorResponse.txt diff --git a/docs/list-of-supported-messages.rst b/docs/list-of-supported-messages.rst index 0e2917310..05009fd1d 100644 --- a/docs/list-of-supported-messages.rst +++ b/docs/list-of-supported-messages.rst @@ -42,6 +42,7 @@ This is the list of messages that are at least partially supported at this time: - DocIssuance_IssueMiscellaneousDocuments - DocIssuance_IssueCombined - Service_IntegratedPricing +- Hotel_Sell - Offer_CreateOffer - Offer_VerifyOffer - Offer_ConfirmAirOffer @@ -83,7 +84,6 @@ These messages will be implemented at some point in the future. *Pull requests a - 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 72a424f18..fc61d7047 100644 --- a/docs/samples.rst +++ b/docs/samples.rst @@ -1763,6 +1763,14 @@ Assign an account code to a passenger: ]) ); +***** +Hotel +***** +---------- +Hotel_Sell +---------- + +*coming soon* **** Info 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/HotelSellOptions.php b/src/Amadeus/Client/RequestOptions/HotelSellOptions.php index b2f118837..9a2000a3e 100644 --- a/src/Amadeus/Client/RequestOptions/HotelSellOptions.php +++ b/src/Amadeus/Client/RequestOptions/HotelSellOptions.php @@ -22,6 +22,8 @@ namespace Amadeus\Client\RequestOptions; +use Amadeus\Client\RequestOptions\Hotel\Sell\BookingCompany; + /** * Hotel_Sell Request Options * @@ -30,5 +32,27 @@ */ 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 = []; + } diff --git a/src/Amadeus/Client/Struct/Hotel/Sell.php b/src/Amadeus/Client/Struct/Hotel/Sell.php index 9372b1318..1a7b167c4 100644 --- a/src/Amadeus/Client/Struct/Hotel/Sell.php +++ b/src/Amadeus/Client/Struct/Hotel/Sell.php @@ -24,6 +24,15 @@ use Amadeus\Client\RequestOptions\HotelSellOptions; use Amadeus\Client\Struct\BaseWsMessage; +use Amadeus\Client\Struct\Hotel\Sell\ArrivalFlightDetailsGrp; +use Amadeus\Client\Struct\Hotel\Sell\BookingCompany; +use Amadeus\Client\Struct\Hotel\Sell\BookingPayerDetails; +use Amadeus\Client\Struct\Hotel\Sell\ExtraIndentification; +use Amadeus\Client\Struct\Hotel\Sell\GroupIndicator; +use Amadeus\Client\Struct\Hotel\Sell\RoomStayData; +use Amadeus\Client\Struct\Hotel\Sell\SystemIdentifier; +use Amadeus\Client\Struct\Hotel\Sell\TravelAgentRef; +use Amadeus\Client\Struct\Pnr\ReservationInfo; /** * Hotel_Sell request structure @@ -34,39 +43,47 @@ class Sell extends BaseWsMessage { /** - * @var + * @var SystemIdentifier */ public $systemIdentifier; + /** - * @var + * @var BookingCompany[] */ - public $bookingCompany; + public $bookingCompany = []; + /** - * @var + * @var ReservationInfo */ public $reservationInfo; + /** - * @var + * @var ExtraIndentification */ public $extraIndentification; + /** - * @var + * @var GroupIndicator */ public $groupIndicator; + /** - * @var + * @var TravelAgentRef[] */ - public $travelAgentRef; + public $travelAgentRef = []; + /** - * @var + * @var BookingPayerDetails */ public $bookingPayerDetails; + /** - * @var + * @var RoomStayData[] */ - public $roomStayData; + public $roomStayData = []; + /** - * @var + * @var ArrivalFlightDetailsGrp */ public $arrivalFlightDetailsGrp; 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..8810b44e0 --- /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..678ef72d0 --- /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/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 + + + + + From 1e426cf8dc48c80bd3d10fb364cef08fbe9fb0f2 Mon Sep 17 00:00:00 2001 From: dieter Date: Wed, 11 Jan 2017 11:41:29 +0100 Subject: [PATCH 04/14] Continuing Hotel_Sell implementation --- .../RequestOptions/Hotel/Sell/Booker.php | 55 +++++++++++++++++++ .../RequestOptions/HotelSellOptions.php | 5 ++ 2 files changed, 60 insertions(+) create mode 100644 src/Amadeus/Client/RequestOptions/Hotel/Sell/Booker.php 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..0d585fef9 --- /dev/null +++ b/src/Amadeus/Client/RequestOptions/Hotel/Sell/Booker.php @@ -0,0 +1,55 @@ + + */ +class Booker extends LoadParamsFromArray +{ + /** + * Number of travellers + * @var int + */ + public $travellerCount = 1; + + public $firstName; + + public $lastName; + + public $title; + + /** + * Gender - 'M' or 'F' + * + * @var string + */ + public $gender; + + +} diff --git a/src/Amadeus/Client/RequestOptions/HotelSellOptions.php b/src/Amadeus/Client/RequestOptions/HotelSellOptions.php index 9a2000a3e..6cbacd914 100644 --- a/src/Amadeus/Client/RequestOptions/HotelSellOptions.php +++ b/src/Amadeus/Client/RequestOptions/HotelSellOptions.php @@ -54,5 +54,10 @@ class HotelSellOptions extends Base */ public $bookingCompany = []; + /** + * @var Booker + */ + public $booker; + } From 8276110a708d7dc06b1a748747f46e5e7e4cd708 Mon Sep 17 00:00:00 2001 From: dieter Date: Wed, 11 Jan 2017 11:41:51 +0100 Subject: [PATCH 05/14] Continuing Hotel_Sell implementation --- src/Amadeus/Client/RequestOptions/HotelSellOptions.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Amadeus/Client/RequestOptions/HotelSellOptions.php b/src/Amadeus/Client/RequestOptions/HotelSellOptions.php index 6cbacd914..b262ae37d 100644 --- a/src/Amadeus/Client/RequestOptions/HotelSellOptions.php +++ b/src/Amadeus/Client/RequestOptions/HotelSellOptions.php @@ -22,6 +22,7 @@ namespace Amadeus\Client\RequestOptions; +use Amadeus\Client\RequestOptions\Hotel\Sell\Booker; use Amadeus\Client\RequestOptions\Hotel\Sell\BookingCompany; /** From b09ff34c7c4902e297b40895bb75932c239774ea Mon Sep 17 00:00:00 2001 From: dieter Date: Mon, 24 Apr 2017 16:41:30 +0200 Subject: [PATCH 06/14] Initial testimplementation of Hotel_MultiSingleAvailability for testing classmap and multiwsdl --- composer.lock | 39 ++-- src/Amadeus/Client.php | 16 ++ .../Hotel/MultiSingleAvailabilityConv.php | 46 ++++ .../Hotel/MultiSingleAvail/Criteria.php | 64 ++++++ .../Hotel/MultiSingleAvail/Guest.php | 67 ++++++ .../Hotel/MultiSingleAvail/HotelReference.php | 59 +++++ .../Hotel/MultiSingleAvail/Rates.php | 67 ++++++ .../Hotel/MultiSingleAvail/Room.php | 60 +++++ .../Hotel/MultiSingleAvail/Segment.php | 60 +++++ .../RequestOptions/Hotel/Sell/Booker.php | 2 - .../HotelMultiSingleAvailOptions.php | 130 +++++++++++ .../RequestOptions/HotelSellOptions.php | 2 - .../Hotel/HandlerMultiSingleAvailability.php | 54 +++++ .../StandardResponseHandler.php | 48 +++- src/Amadeus/Client/Result/NotOk.php | 17 +- src/Amadeus/Client/Session/Handler/Base.php | 7 + .../Hotel/LoaderMultiSingleAvailability.php | 60 +++++ .../Session/MsgClassmap/LoadInterface.php | 40 ++++ .../Client/Session/MsgClassmap/Loader.php | 109 +++++++++ .../Struct/Hotel/MultiSingleAvailability.php | 155 +++++++++++++ .../AvailRequestSegment.php | 63 ++++++ .../AvailRequestSegments.php | 42 ++++ .../MultiSingleAvailability/Criterion.php | 67 ++++++ .../MultiSingleAvailability/GuestCount.php | 55 +++++ .../MultiSingleAvailability/GuestCounts.php | 59 +++++ .../MultiSingleAvailability/HotelRef.php | 103 +++++++++ .../HotelSearchCriteria.php | 33 +++ .../HotelSearchCriteriaType.php | 68 ++++++ .../HotelSearchCriterionType.php | 122 ++++++++++ .../ItemSearchCriterionType.php | 60 +++++ .../Hotel/MultiSingleAvailability/PosType.php | 37 +++ .../MultiSingleAvailability/RateRange.php | 88 +++++++ .../RoomStayCandidate.php | 62 +++++ .../RoomStayCandidates.php | 37 +++ .../MultiSingleAvailability/StayDateRange.php | 82 +++++++ .../Struct/Hotel/Sell/AttributeDetails.php | 8 +- .../Struct/Hotel/Sell/DeliveringSystem.php | 12 +- .../Client/ResponseHandler/BaseTest.php | 18 ++ ...elMultiSingleAvailabilityErrorResponse.txt | 5 + ...MultiSingleAvailabilityWarningResponse.txt | 6 + .../Client/Session/MsgClassmap/LoaderTest.php | 50 ++++ tests/Amadeus/ClientTest.php | 46 ++++ .../hotelMultiSingleAvailabilityReply100.txt | 214 ++++++++++++++++++ 43 files changed, 2403 insertions(+), 36 deletions(-) create mode 100644 src/Amadeus/Client/RequestCreator/Converter/Hotel/MultiSingleAvailabilityConv.php create mode 100644 src/Amadeus/Client/RequestOptions/Hotel/MultiSingleAvail/Criteria.php create mode 100644 src/Amadeus/Client/RequestOptions/Hotel/MultiSingleAvail/Guest.php create mode 100644 src/Amadeus/Client/RequestOptions/Hotel/MultiSingleAvail/HotelReference.php create mode 100644 src/Amadeus/Client/RequestOptions/Hotel/MultiSingleAvail/Rates.php create mode 100644 src/Amadeus/Client/RequestOptions/Hotel/MultiSingleAvail/Room.php create mode 100644 src/Amadeus/Client/RequestOptions/Hotel/MultiSingleAvail/Segment.php create mode 100644 src/Amadeus/Client/RequestOptions/HotelMultiSingleAvailOptions.php create mode 100644 src/Amadeus/Client/ResponseHandler/Hotel/HandlerMultiSingleAvailability.php create mode 100644 src/Amadeus/Client/Session/MsgClassmap/Hotel/LoaderMultiSingleAvailability.php create mode 100644 src/Amadeus/Client/Session/MsgClassmap/LoadInterface.php create mode 100644 src/Amadeus/Client/Session/MsgClassmap/Loader.php create mode 100644 src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability.php create mode 100644 src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/AvailRequestSegment.php create mode 100644 src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/AvailRequestSegments.php create mode 100644 src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Criterion.php create mode 100644 src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/GuestCount.php create mode 100644 src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/GuestCounts.php create mode 100644 src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/HotelRef.php create mode 100644 src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/HotelSearchCriteria.php create mode 100644 src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/HotelSearchCriteriaType.php create mode 100644 src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/HotelSearchCriterionType.php create mode 100644 src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/ItemSearchCriterionType.php create mode 100644 src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/PosType.php create mode 100644 src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/RateRange.php create mode 100644 src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/RoomStayCandidate.php create mode 100644 src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/RoomStayCandidates.php create mode 100644 src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/StayDateRange.php create mode 100644 tests/Amadeus/Client/ResponseHandler/testfiles/dummyHotelMultiSingleAvailabilityErrorResponse.txt create mode 100644 tests/Amadeus/Client/ResponseHandler/testfiles/dummyHotelMultiSingleAvailabilityWarningResponse.txt create mode 100644 tests/Amadeus/Client/Session/MsgClassmap/LoaderTest.php create mode 100644 tests/Amadeus/testfiles/hotelMultiSingleAvailabilityReply100.txt 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/src/Amadeus/Client.php b/src/Amadeus/Client.php index 3839cfe3e..07206ecdd 100644 --- a/src/Amadeus/Client.php +++ b/src/Amadeus/Client.php @@ -997,6 +997,22 @@ 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 * 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/RequestOptions/Hotel/MultiSingleAvail/Criteria.php b/src/Amadeus/Client/RequestOptions/Hotel/MultiSingleAvail/Criteria.php new file mode 100644 index 000000000..03780ab19 --- /dev/null +++ b/src/Amadeus/Client/RequestOptions/Hotel/MultiSingleAvail/Criteria.php @@ -0,0 +1,64 @@ + + */ +class Criteria extends LoadParamsFromArray +{ + /** + * @var bool + */ + public $exactMatch; + + /** + * @var HotelReference[] + */ + public $hotelReferences = []; + + /** + * @var \DateTime + */ + public $stayStart; + + /** + * @var \DateTime + */ + public $stayEnd; + + /** + * @var Rates[] + */ + public $rates = []; + + /** + * @var Room[] + */ + public $rooms = []; +} 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..90198ddf6 --- /dev/null +++ b/src/Amadeus/Client/RequestOptions/Hotel/MultiSingleAvail/Guest.php @@ -0,0 +1,67 @@ + + */ +class Guest +{ + 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 index 0d585fef9..c21950071 100644 --- a/src/Amadeus/Client/RequestOptions/Hotel/Sell/Booker.php +++ b/src/Amadeus/Client/RequestOptions/Hotel/Sell/Booker.php @@ -50,6 +50,4 @@ class Booker extends LoadParamsFromArray * @var string */ public $gender; - - } 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 index b262ae37d..cdd322a27 100644 --- a/src/Amadeus/Client/RequestOptions/HotelSellOptions.php +++ b/src/Amadeus/Client/RequestOptions/HotelSellOptions.php @@ -59,6 +59,4 @@ class HotelSellOptions extends Base * @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/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..6bb33d3c0 100644 --- a/src/Amadeus/Client/Session/Handler/Base.php +++ b/src/Amadeus/Client/Session/Handler/Base.php @@ -75,6 +75,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 * 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..ceb2d320f --- /dev/null +++ b/src/Amadeus/Client/Session/MsgClassmap/Hotel/LoaderMultiSingleAvailability.php @@ -0,0 +1,60 @@ + + */ +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:AvailRequestSegment' => 'Amadeus\Client\Struct\Hotel\MultiSingleAvailability\AvailRequestSegment', + 'ota_2003_05:AvailRequestSegments' => 'Amadeus\Client\Struct\Hotel\MultiSingleAvailability\AvailRequestSegments', + 'ota_2003_05:Criterion' => 'Amadeus\Client\Struct\Hotel\MultiSingleAvailability\Criterion', + '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:HotelSearchCriterionType' => 'Amadeus\Client\Struct\Hotel\MultiSingleAvailability\HotelSearchCriterionType', + 'ota_2003_05:ItemSearchCriterionType' => 'Amadeus\Client\Struct\Hotel\MultiSingleAvailability\ItemSearchCriterionType', + '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..b69c1400c --- /dev/null +++ b/src/Amadeus/Client/Session/MsgClassmap/Loader.php @@ -0,0 +1,109 @@ + + */ +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 + * + * @param array $messagesAndVersions e.g. ['PNR_Retrieve' => '14.2', 'Security_Authenticate' => '6.1'] + * @return array + */ + public static function loadMessagesSpecificClasses($messagesAndVersions) + { + $msgSpecificClassMap = []; + + foreach ($messagesAndVersions as $message => $version) { + $msgSpecificClassMap = array_merge( + $msgSpecificClassMap, + self::loadClassMapForMessage($message, $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/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..3eaaeb162 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/AvailRequestSegments.php @@ -0,0 +1,42 @@ + + */ +class AvailRequestSegments +{ + /** + * @var AvailRequestSegment[] + */ + public $AvailRequestSegment = []; + + /** + * @var int + */ + public $MaximumWaitTime; +} 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..39e2b5e16 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Criterion.php @@ -0,0 +1,67 @@ + + */ +class Criterion extends HotelSearchCriterionType +{ + /*** + * @var string + */ + public $AlternateAvailability; + + /** + * 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); + } + } + } +} 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/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..d70b86543 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/HotelSearchCriterionType.php @@ -0,0 +1,122 @@ + + */ +class HotelSearchCriterionType extends ItemSearchCriterionType +{ + /** + * @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; +} 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..895cdc1bc --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/ItemSearchCriterionType.php @@ -0,0 +1,60 @@ + + */ +class ItemSearchCriterionType +{ + /** + * @var bool + */ + public $ExactMatch; + + public $ImportanceType; + + public $Ranking; + + public $Position; + + public $Address; + + public $RefPoint = []; + + public $CodeRef; + + /** + * @var HotelRef[] + */ + public $HotelRef = []; + + public $Radius; + + public $MapArea; + + public $AdditionalContents; +} 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/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/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/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/Sell/AttributeDetails.php b/src/Amadeus/Client/Struct/Hotel/Sell/AttributeDetails.php index 8810b44e0..82803ad31 100644 --- a/src/Amadeus/Client/Struct/Hotel/Sell/AttributeDetails.php +++ b/src/Amadeus/Client/Struct/Hotel/Sell/AttributeDetails.php @@ -30,10 +30,10 @@ */ class AttributeDetails { - const TYPE_BRAND = "BRA"; - const TYPE_CORPORATION_NAME = "CORP"; - const TYPE_SUB_BRAND = "SBR"; - const TYPE_SUB_SUB_BRAND = "SSB"; + const TYPE_BRAND = "BRA"; + const TYPE_CORPORATION_NAME = "CORP"; + const TYPE_SUB_BRAND = "SBR"; + const TYPE_SUB_SUB_BRAND = "SSB"; /** * self::TYPE_* diff --git a/src/Amadeus/Client/Struct/Hotel/Sell/DeliveringSystem.php b/src/Amadeus/Client/Struct/Hotel/Sell/DeliveringSystem.php index 678ef72d0..3b65f33e9 100644 --- a/src/Amadeus/Client/Struct/Hotel/Sell/DeliveringSystem.php +++ b/src/Amadeus/Client/Struct/Hotel/Sell/DeliveringSystem.php @@ -30,13 +30,13 @@ */ 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_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"; + const COMPANY_WEBSERVICES = "WEBS"; /** * self::COMPANY_* diff --git a/tests/Amadeus/Client/ResponseHandler/BaseTest.php b/tests/Amadeus/Client/ResponseHandler/BaseTest.php index 23311d0bc..2d1fbd440 100644 --- a/tests/Amadeus/Client/ResponseHandler/BaseTest.php +++ b/tests/Amadeus/Client/ResponseHandler/BaseTest.php @@ -741,6 +741,24 @@ 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'; + + $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/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/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 + + + + + + + + + + + + + + + + + + + +
From 2bdc8acbcaa76a6937115b7b43018dccdda698ec Mon Sep 17 00:00:00 2001 From: dieter Date: Tue, 25 Apr 2017 10:08:20 +0200 Subject: [PATCH 07/14] AvailRequestSegmentsType added --- CHANGELOG.md | 2 + docs/list-of-supported-messages.rst | 2 +- .../RequestOptions/Hotel/Sell/Booker.php | 10 +++++ .../Hotel/LoaderMultiSingleAvailability.php | 3 +- .../AvailRequestSegments.php | 11 +---- .../AvailRequestSegmentsType.php | 42 +++++++++++++++++++ .../MultiSingleAvailability/Criterion.php | 2 +- 7 files changed, 59 insertions(+), 13 deletions(-) create mode 100644 src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/AvailRequestSegmentsType.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 84567d8fb..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 diff --git a/docs/list-of-supported-messages.rst b/docs/list-of-supported-messages.rst index 3cdd72ffc..4d82ec28c 100644 --- a/docs/list-of-supported-messages.rst +++ b/docs/list-of-supported-messages.rst @@ -48,6 +48,7 @@ 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 @@ -88,7 +89,6 @@ 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_CompleteReservationDetails diff --git a/src/Amadeus/Client/RequestOptions/Hotel/Sell/Booker.php b/src/Amadeus/Client/RequestOptions/Hotel/Sell/Booker.php index c21950071..384108e31 100644 --- a/src/Amadeus/Client/RequestOptions/Hotel/Sell/Booker.php +++ b/src/Amadeus/Client/RequestOptions/Hotel/Sell/Booker.php @@ -34,14 +34,24 @@ class Booker extends LoadParamsFromArray { /** * Number of travellers + * * @var int */ public $travellerCount = 1; + /** + * @var string + */ public $firstName; + /** + * @var string + */ public $lastName; + /** + * @var string + */ public $title; /** diff --git a/src/Amadeus/Client/Session/MsgClassmap/Hotel/LoaderMultiSingleAvailability.php b/src/Amadeus/Client/Session/MsgClassmap/Hotel/LoaderMultiSingleAvailability.php index ceb2d320f..b173629e3 100644 --- a/src/Amadeus/Client/Session/MsgClassmap/Hotel/LoaderMultiSingleAvailability.php +++ b/src/Amadeus/Client/Session/MsgClassmap/Hotel/LoaderMultiSingleAvailability.php @@ -40,8 +40,9 @@ public static function loadClassMapForMessage($version) { return [ 'ota_2003_05:OTA_HotelAvailRQ' => 'Amadeus\Client\Struct\Hotel\MultiSingleAvailability', - 'ota_2003_05:AvailRequestSegment' => 'Amadeus\Client\Struct\Hotel\MultiSingleAvailability\AvailRequestSegment', '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:GuestCount' => 'Amadeus\Client\Struct\Hotel\MultiSingleAvailability\GuestCount', 'ota_2003_05:GuestCounts' => 'Amadeus\Client\Struct\Hotel\MultiSingleAvailability\GuestCounts', diff --git a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/AvailRequestSegments.php b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/AvailRequestSegments.php index 3eaaeb162..d6893a603 100644 --- a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/AvailRequestSegments.php +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/AvailRequestSegments.php @@ -28,15 +28,6 @@ * @package Amadeus\Client\Struct\Hotel\MultiSingleAvailability * @author Dieter Devlieghere */ -class AvailRequestSegments +class AvailRequestSegments extends AvailRequestSegmentsType { - /** - * @var AvailRequestSegment[] - */ - public $AvailRequestSegment = []; - - /** - * @var int - */ - public $MaximumWaitTime; } 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/Criterion.php b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Criterion.php index 39e2b5e16..cb9415640 100644 --- a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Criterion.php +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Criterion.php @@ -57,7 +57,7 @@ public function __construct(Criteria $criterion) } if (!empty($criterion->rooms)) { - $this->RoomStayCandidates = new RoomStayCandidates(); + $this->RoomStayCandidates = new RoomStayCandidates(); foreach ($criterion->rooms as $room) { $this->RoomStayCandidates->RoomStayCandidate[] = new RoomStayCandidate($room); From 38574bbcbc89657440b84ca66031eeafb113b5fd Mon Sep 17 00:00:00 2001 From: dieter Date: Tue, 25 Apr 2017 10:28:56 +0200 Subject: [PATCH 08/14] Guest is a LoadParamsFromArray --- .../Client/RequestOptions/Hotel/MultiSingleAvail/Guest.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Amadeus/Client/RequestOptions/Hotel/MultiSingleAvail/Guest.php b/src/Amadeus/Client/RequestOptions/Hotel/MultiSingleAvail/Guest.php index 90198ddf6..7284e8699 100644 --- a/src/Amadeus/Client/RequestOptions/Hotel/MultiSingleAvail/Guest.php +++ b/src/Amadeus/Client/RequestOptions/Hotel/MultiSingleAvail/Guest.php @@ -22,13 +22,15 @@ namespace Amadeus\Client\RequestOptions\Hotel\MultiSingleAvail; +use Amadeus\Client\LoadParamsFromArray; + /** * Guest * * @package Amadeus\Client\RequestOptions\Hotel\MultiSingleAvail * @author Dieter Devlieghere */ -class Guest +class Guest extends LoadParamsFromArray { const OCCUPANT_OVER_21 = 1; const OCCUPANT_OVER_65 = 2; From 3819ec74bc7617c70e72e0b04870a314a6d21a6c Mon Sep 17 00:00:00 2001 From: dieter Date: Tue, 25 Apr 2017 14:19:55 +0200 Subject: [PATCH 09/14] Forgot loading MessageClassmap. --- src/Amadeus/Client/Session/Handler/Base.php | 3 + .../Client/Session/Handler/SoapHeader4.php | 6 +- .../Client/Session/MsgClassmap/Loader.php | 17 +++- .../HotelMultiSingleAvailabilityTest.php | 99 +++++++++++++++++++ 4 files changed, 121 insertions(+), 4 deletions(-) create mode 100644 tests/Amadeus/Client/Struct/Hotel/HotelMultiSingleAvailabilityTest.php diff --git a/src/Amadeus/Client/Session/Handler/Base.php b/src/Amadeus/Client/Session/Handler/Base.php index 6bb33d3c0..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; @@ -320,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/Loader.php b/src/Amadeus/Client/Session/MsgClassmap/Loader.php index b69c1400c..b3f5a32e1 100644 --- a/src/Amadeus/Client/Session/MsgClassmap/Loader.php +++ b/src/Amadeus/Client/Session/MsgClassmap/Loader.php @@ -47,17 +47,28 @@ class Loader /** * Load extra ClassMaps needed for the messages and versions in the WSAP * - * @param array $messagesAndVersions e.g. ['PNR_Retrieve' => '14.2', 'Security_Authenticate' => '6.1'] + * 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 => $version) { + foreach ($messagesAndVersions as $message => $messageInfo) { $msgSpecificClassMap = array_merge( $msgSpecificClassMap, - self::loadClassMapForMessage($message, $version) + self::loadClassMapForMessage($message, $messageInfo["version"]) ); } diff --git a/tests/Amadeus/Client/Struct/Hotel/HotelMultiSingleAvailabilityTest.php b/tests/Amadeus/Client/Struct/Hotel/HotelMultiSingleAvailabilityTest.php new file mode 100644 index 000000000..80ae5148d --- /dev/null +++ b/tests/Amadeus/Client/Struct/Hotel/HotelMultiSingleAvailabilityTest.php @@ -0,0 +1,99 @@ + + */ +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); + + //TODO other asserts + } +} From 80710963a15d7f662b0bba2df12d005b1cab09b7 Mon Sep 17 00:00:00 2001 From: dieter Date: Wed, 26 Apr 2017 11:48:12 +0200 Subject: [PATCH 10/14] Testing Criterion loading with AlternateAvailability --- .../RequestOptions/Hotel/MultiSingleAvail/Criteria.php | 9 +++++++++ .../Struct/Hotel/MultiSingleAvailability/Criterion.php | 7 +++++++ .../MultiSingleAvailability/HotelSearchCriterionType.php | 4 ---- tests/Amadeus/Client/ResponseHandler/BaseTest.php | 2 ++ .../Struct/Hotel/HotelMultiSingleAvailabilityTest.php | 5 ++++- 5 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/Amadeus/Client/RequestOptions/Hotel/MultiSingleAvail/Criteria.php b/src/Amadeus/Client/RequestOptions/Hotel/MultiSingleAvail/Criteria.php index 03780ab19..8fdf0f207 100644 --- a/src/Amadeus/Client/RequestOptions/Hotel/MultiSingleAvail/Criteria.php +++ b/src/Amadeus/Client/RequestOptions/Hotel/MultiSingleAvail/Criteria.php @@ -32,6 +32,8 @@ */ class Criteria extends LoadParamsFromArray { + const ALT_AVAIL_NEVER = "Never"; + /** * @var bool */ @@ -61,4 +63,11 @@ class Criteria extends LoadParamsFromArray * @var Room[] */ public $rooms = []; + + /** + * self::ALT_AVAIL_* + * + * @var string + */ + public $alternateAvailability; } diff --git a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Criterion.php b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Criterion.php index cb9415640..c7b6174a4 100644 --- a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Criterion.php +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Criterion.php @@ -37,6 +37,11 @@ class Criterion extends HotelSearchCriterionType */ public $AlternateAvailability; + /** + * @var RateRange[] + */ + public $RateRange = []; + /** * Criterion constructor. * @@ -63,5 +68,7 @@ public function __construct(Criteria $criterion) $this->RoomStayCandidates->RoomStayCandidate[] = new RoomStayCandidate($room); } } + + $this->AlternateAvailability = $criterion->alternateAvailability; } } diff --git a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/HotelSearchCriterionType.php b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/HotelSearchCriterionType.php index d70b86543..cfcae9207 100644 --- a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/HotelSearchCriterionType.php +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/HotelSearchCriterionType.php @@ -70,10 +70,6 @@ class HotelSearchCriterionType extends ItemSearchCriterionType */ public $StayDateRange; - /** - * @var RateRange[] - */ - public $RateRange = []; /** * @var RatePlanCandidates diff --git a/tests/Amadeus/Client/ResponseHandler/BaseTest.php b/tests/Amadeus/Client/ResponseHandler/BaseTest.php index 2d1fbd440..03aa96282 100644 --- a/tests/Amadeus/Client/ResponseHandler/BaseTest.php +++ b/tests/Amadeus/Client/ResponseHandler/BaseTest.php @@ -749,6 +749,8 @@ public function testCanHandleHotelMultiSingleAvailabilityErr() $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); diff --git a/tests/Amadeus/Client/Struct/Hotel/HotelMultiSingleAvailabilityTest.php b/tests/Amadeus/Client/Struct/Hotel/HotelMultiSingleAvailabilityTest.php index 80ae5148d..703b3896f 100644 --- a/tests/Amadeus/Client/Struct/Hotel/HotelMultiSingleAvailabilityTest.php +++ b/tests/Amadeus/Client/Struct/Hotel/HotelMultiSingleAvailabilityTest.php @@ -94,6 +94,9 @@ public function testCanMakeMessage() $this->assertCount(1, $msg->AvailRequestSegments->AvailRequestSegment); $this->assertEquals('Distribution', $msg->AvailRequestSegments->AvailRequestSegment[0]->InfoSource); - //TODO other asserts + $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); } } From baa494f547754415b71df0da05e0d53049d6b6f2 Mon Sep 17 00:00:00 2001 From: dieter Date: Wed, 26 Apr 2017 14:26:12 +0200 Subject: [PATCH 11/14] Testing Criterion loading with AlternateAvailability --- .../Hotel/LoaderMultiSingleAvailability.php | 4 +-- .../AcceptedPayments.php | 33 +++++++++++++++++++ .../Hotel/MultiSingleAvailability/Award.php | 33 +++++++++++++++++++ .../MultiSingleAvailability/Criterion.php | 4 --- .../MultiSingleAvailability/HotelAmenity.php | 33 +++++++++++++++++++ .../MultiSingleAvailability/HotelFeature.php | 33 +++++++++++++++++++ .../HotelMeetingFacility.php | 33 +++++++++++++++++++ .../HotelSearchCriterionType.php | 5 +++ .../ItemSearchCriterionType.php | 2 ++ .../MultiSingleAvailability/MealPlan.php | 33 +++++++++++++++++++ .../Hotel/MultiSingleAvailability/Media.php | 33 +++++++++++++++++++ .../MultiSingleAvailability/Profiles.php | 33 +++++++++++++++++++ .../RatePlanCandidates.php | 33 +++++++++++++++++++ .../RebatePrograms.php | 33 +++++++++++++++++++ .../MultiSingleAvailability/Recreation.php | 33 +++++++++++++++++++ .../MultiSingleAvailability/RoomAmenity.php | 33 +++++++++++++++++++ .../Hotel/MultiSingleAvailability/Service.php | 33 +++++++++++++++++++ .../Transportation.php | 33 +++++++++++++++++++ .../UserGeneratedContent.php | 33 +++++++++++++++++++ 19 files changed, 504 insertions(+), 6 deletions(-) create mode 100644 src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/AcceptedPayments.php create mode 100644 src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Award.php create mode 100644 src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/HotelAmenity.php create mode 100644 src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/HotelFeature.php create mode 100644 src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/HotelMeetingFacility.php create mode 100644 src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/MealPlan.php create mode 100644 src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Media.php create mode 100644 src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Profiles.php create mode 100644 src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/RatePlanCandidates.php create mode 100644 src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/RebatePrograms.php create mode 100644 src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Recreation.php create mode 100644 src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/RoomAmenity.php create mode 100644 src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Service.php create mode 100644 src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Transportation.php create mode 100644 src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/UserGeneratedContent.php diff --git a/src/Amadeus/Client/Session/MsgClassmap/Hotel/LoaderMultiSingleAvailability.php b/src/Amadeus/Client/Session/MsgClassmap/Hotel/LoaderMultiSingleAvailability.php index b173629e3..3dd8aa9f5 100644 --- a/src/Amadeus/Client/Session/MsgClassmap/Hotel/LoaderMultiSingleAvailability.php +++ b/src/Amadeus/Client/Session/MsgClassmap/Hotel/LoaderMultiSingleAvailability.php @@ -44,13 +44,13 @@ public static function loadClassMapForMessage($version) '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:HotelSearchCriterionType' => 'Amadeus\Client\Struct\Hotel\MultiSingleAvailability\HotelSearchCriterionType', - 'ota_2003_05:ItemSearchCriterionType' => 'Amadeus\Client\Struct\Hotel\MultiSingleAvailability\ItemSearchCriterionType', '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', 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/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 index c7b6174a4..daa039b7e 100644 --- a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Criterion.php +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Criterion.php @@ -37,10 +37,6 @@ class Criterion extends HotelSearchCriterionType */ public $AlternateAvailability; - /** - * @var RateRange[] - */ - public $RateRange = []; /** * Criterion constructor. 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/HotelSearchCriterionType.php b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/HotelSearchCriterionType.php index cfcae9207..94838a1de 100644 --- a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/HotelSearchCriterionType.php +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/HotelSearchCriterionType.php @@ -76,6 +76,11 @@ class HotelSearchCriterionType extends ItemSearchCriterionType */ public $RatePlanCandidates; + /** + * @var RateRange[] + */ + public $RateRange = []; + /** * @var Profiles */ diff --git a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/ItemSearchCriterionType.php b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/ItemSearchCriterionType.php index 895cdc1bc..b6344fdba 100644 --- a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/ItemSearchCriterionType.php +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/ItemSearchCriterionType.php @@ -43,6 +43,8 @@ class ItemSearchCriterionType public $Address; + public $Telephone; + public $RefPoint = []; public $CodeRef; 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/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/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/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/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 +{ +} From 073cfe9f63dfe5a534ee1efc1b9cbf0e12b1166e Mon Sep 17 00:00:00 2001 From: dieter Date: Wed, 26 Apr 2017 15:18:42 +0200 Subject: [PATCH 12/14] Testing Criterion loading with AlternateAvailability --- .../Struct/Hotel/MultiSingleAvailability/Criterion.php | 5 +++++ .../MultiSingleAvailability/HotelSearchCriterionType.php | 9 ++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Criterion.php b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Criterion.php index daa039b7e..c631fe691 100644 --- a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Criterion.php +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Criterion.php @@ -37,6 +37,11 @@ class Criterion extends HotelSearchCriterionType */ public $AlternateAvailability; + public $AddressSearchScope; + + public $InfoSource; + + public $MoreDataEchoToken; /** * Criterion constructor. diff --git a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/HotelSearchCriterionType.php b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/HotelSearchCriterionType.php index 94838a1de..d70b86543 100644 --- a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/HotelSearchCriterionType.php +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/HotelSearchCriterionType.php @@ -70,16 +70,15 @@ class HotelSearchCriterionType extends ItemSearchCriterionType */ public $StayDateRange; - /** - * @var RatePlanCandidates + * @var RateRange[] */ - public $RatePlanCandidates; + public $RateRange = []; /** - * @var RateRange[] + * @var RatePlanCandidates */ - public $RateRange = []; + public $RatePlanCandidates; /** * @var Profiles From 7bdd5ac69174c8c4ab200eae819300f5ec2556f7 Mon Sep 17 00:00:00 2001 From: dieter Date: Tue, 16 May 2017 16:46:08 +0200 Subject: [PATCH 13/14] Criterion without inheritance --- .../MultiSingleAvailability/Criterion.php | 122 +++++++++++++++++- 1 file changed, 121 insertions(+), 1 deletion(-) diff --git a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Criterion.php b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Criterion.php index c631fe691..fda19c4a6 100644 --- a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Criterion.php +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Criterion.php @@ -30,7 +30,7 @@ * @package Amadeus\Client\Struct\Hotel\MultiSingleAvailability * @author Dieter Devlieghere */ -class Criterion extends HotelSearchCriterionType +class Criterion { /*** * @var string @@ -43,6 +43,126 @@ class Criterion extends HotelSearchCriterionType public $MoreDataEchoToken; + /** + * @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; + /** * Criterion constructor. * From 7a8fa19aefdbcfb39e1885acda90e454cfa32442 Mon Sep 17 00:00:00 2001 From: dieter Date: Tue, 16 May 2017 17:24:30 +0200 Subject: [PATCH 14/14] HotelSearchCriterionType without inheritance --- .../MultiSingleAvailability/Criterion.php | 122 +----------------- .../HotelSearchCriterionType.php | 32 ++++- .../ItemSearchCriterionType.php | 2 + 3 files changed, 34 insertions(+), 122 deletions(-) diff --git a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Criterion.php b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Criterion.php index fda19c4a6..c631fe691 100644 --- a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Criterion.php +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Criterion.php @@ -30,7 +30,7 @@ * @package Amadeus\Client\Struct\Hotel\MultiSingleAvailability * @author Dieter Devlieghere */ -class Criterion +class Criterion extends HotelSearchCriterionType { /*** * @var string @@ -43,126 +43,6 @@ class Criterion public $MoreDataEchoToken; - /** - * @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; - /** * Criterion constructor. * diff --git a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/HotelSearchCriterionType.php b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/HotelSearchCriterionType.php index d70b86543..591cc4599 100644 --- a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/HotelSearchCriterionType.php +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/HotelSearchCriterionType.php @@ -28,7 +28,7 @@ * @package Amadeus\Client\Struct\Hotel\MultiSingleAvailability * @author Dieter Devlieghere */ -class HotelSearchCriterionType extends ItemSearchCriterionType +class HotelSearchCriterionType { /** * @var HotelAmenity[] @@ -119,4 +119,34 @@ class HotelSearchCriterionType extends ItemSearchCriterionType * @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 index b6344fdba..dd0ac2a4f 100644 --- a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/ItemSearchCriterionType.php +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/ItemSearchCriterionType.php @@ -59,4 +59,6 @@ class ItemSearchCriterionType public $MapArea; public $AdditionalContents; + + }