From b2e883ef1196ddbbb8f6019d6793dadd545f3696 Mon Sep 17 00:00:00 2001 From: dieter Date: Fri, 16 Dec 2016 12:23:49 +0100 Subject: [PATCH 01/86] 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/86] 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/86] 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/86] 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/86] 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/86] 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/86] 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/86] 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/86] 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/86] 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/86] 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/86] 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/86] 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/86] 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; + + } From 5340e483992167234d04400ef0715a9d8f5a6357 Mon Sep 17 00:00:00 2001 From: Gabriele Date: Wed, 25 Jul 2018 15:32:49 +0200 Subject: [PATCH 15/86] init --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index b1a2c081e..6f9cec231 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "amabnl/amadeus-ws-client", + "name": "LeoTravel/amadeus-ws-client", "type": "library", "description": "SOAP Web Service client library for interacting with the Amadeus GDS through its SOAP interface", "keywords": ["amadeus", "gds", "service", "webservice", "soap", "wsdl", "client", "xml", "travel", "airline", "hotel", "booking", "car", "rental", "offer", "masterpricer"], From 47c1986d4bbc2d4e964a7d3450db4f65cf2b483b Mon Sep 17 00:00:00 2001 From: Gabriele Date: Thu, 2 Aug 2018 19:48:28 +0200 Subject: [PATCH 16/86] Add overrideOptionsWithCriteria for Fare --- .../FarePricePnrWithBookingClassOptions.php | 7 ++++++ .../Fare/InformativePricingWithoutPNR13.php | 1 + .../Fare/PricePNRWithBookingClass13.php | 23 +++++++++++++++++++ .../Fare/PricePnr13/PricingOptionGroup.php | 6 ++++- 4 files changed, 36 insertions(+), 1 deletion(-) diff --git a/src/Amadeus/Client/RequestOptions/FarePricePnrWithBookingClassOptions.php b/src/Amadeus/Client/RequestOptions/FarePricePnrWithBookingClassOptions.php index aaa699187..d745e915f 100644 --- a/src/Amadeus/Client/RequestOptions/FarePricePnrWithBookingClassOptions.php +++ b/src/Amadeus/Client/RequestOptions/FarePricePnrWithBookingClassOptions.php @@ -123,6 +123,12 @@ class FarePricePnrWithBookingClassOptions extends Base */ public $overrideOptions = []; + + /** + * @var array + */ + public $overrideOptionsWithCriteria = []; + /** * Specify the validating carrier * @@ -265,4 +271,5 @@ class FarePricePnrWithBookingClassOptions extends Base * @var PaxSegRef[] */ public $references = []; + } diff --git a/src/Amadeus/Client/Struct/Fare/InformativePricingWithoutPNR13.php b/src/Amadeus/Client/Struct/Fare/InformativePricingWithoutPNR13.php index 775214335..f068abca4 100644 --- a/src/Amadeus/Client/Struct/Fare/InformativePricingWithoutPNR13.php +++ b/src/Amadeus/Client/Struct/Fare/InformativePricingWithoutPNR13.php @@ -68,6 +68,7 @@ class InformativePricingWithoutPNR13 extends BaseWsMessage public function __construct($options) { if (!is_null($options)) { + $this->loadPassengers($options->passengers); $this->loadSegments($options->segments); diff --git a/src/Amadeus/Client/Struct/Fare/PricePNRWithBookingClass13.php b/src/Amadeus/Client/Struct/Fare/PricePNRWithBookingClass13.php index d534da1d7..aa5812414 100644 --- a/src/Amadeus/Client/Struct/Fare/PricePNRWithBookingClass13.php +++ b/src/Amadeus/Client/Struct/Fare/PricePNRWithBookingClass13.php @@ -171,6 +171,11 @@ public static function loadPricingOptionsFromRequestOptions($options) self::makeOverrideOptions($options->overrideOptions, $priceOptions) ); + $priceOptions = self::mergeOptions( + $priceOptions, + self::makeOverrideOptionsWithCriteria($options->overrideOptionsWithCriteria, $priceOptions) + ); + // All options processed, no options found: if (empty($priceOptions)) { $priceOptions[] = new PricingOptionGroup(PricingOptionKey::OPTION_NO_OPTION); @@ -197,6 +202,24 @@ protected static function makeOverrideOptions($overrideOptions, $priceOptions) return $opt; } + /** + * @param string[] $overrideOptionsWithCriteria + * @param PricingOptionGroup[] $priceOptions + * @return PricingOptionGroup[] + */ + protected static function makeOverrideOptionsWithCriteria($overrideOptionsWithCriteria, $priceOptions) + { + $opt = []; + + foreach ($overrideOptionsWithCriteria as $overrideOptionWithCriteria) { + if (!self::hasPricingGroup($overrideOptionWithCriteria["key"], $priceOptions)) { + $opt[] = new PricingOptionGroup($overrideOptionWithCriteria["key"], $overrideOptionWithCriteria["optionDetail"]); + } + } + + return $opt; + } + /** * @param string|null $validatingCarrier * @return PricePnr13\PricingOptionGroup[] diff --git a/src/Amadeus/Client/Struct/Fare/PricePnr13/PricingOptionGroup.php b/src/Amadeus/Client/Struct/Fare/PricePnr13/PricingOptionGroup.php index 389a86dcb..3ab009884 100644 --- a/src/Amadeus/Client/Struct/Fare/PricePnr13/PricingOptionGroup.php +++ b/src/Amadeus/Client/Struct/Fare/PricePnr13/PricingOptionGroup.php @@ -94,9 +94,13 @@ class PricingOptionGroup * PricingOptionGroup constructor. * * @param string $key + * @param string $optionDetail */ - public function __construct($key) + public function __construct($key, $optionDetail=null) { $this->pricingOptionKey = new PricingOptionKey($key); + if(isset($optionDetail)){ + $this->optionDetail = new OptionDetail($optionDetail); + } } } From 4ff10abcc5700b888654a2a6f82f9814719fc448 Mon Sep 17 00:00:00 2001 From: Gabriele Date: Thu, 2 Aug 2018 20:24:00 +0200 Subject: [PATCH 17/86] issue indentation --- .../RequestOptions/FarePricePnrWithBookingClassOptions.php | 1 - .../Client/Struct/Fare/InformativePricingWithoutPNR13.php | 1 - .../Client/Struct/Fare/PricePnr13/PricingOptionGroup.php | 2 +- 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Amadeus/Client/RequestOptions/FarePricePnrWithBookingClassOptions.php b/src/Amadeus/Client/RequestOptions/FarePricePnrWithBookingClassOptions.php index d745e915f..549717c68 100644 --- a/src/Amadeus/Client/RequestOptions/FarePricePnrWithBookingClassOptions.php +++ b/src/Amadeus/Client/RequestOptions/FarePricePnrWithBookingClassOptions.php @@ -271,5 +271,4 @@ class FarePricePnrWithBookingClassOptions extends Base * @var PaxSegRef[] */ public $references = []; - } diff --git a/src/Amadeus/Client/Struct/Fare/InformativePricingWithoutPNR13.php b/src/Amadeus/Client/Struct/Fare/InformativePricingWithoutPNR13.php index f068abca4..775214335 100644 --- a/src/Amadeus/Client/Struct/Fare/InformativePricingWithoutPNR13.php +++ b/src/Amadeus/Client/Struct/Fare/InformativePricingWithoutPNR13.php @@ -68,7 +68,6 @@ class InformativePricingWithoutPNR13 extends BaseWsMessage public function __construct($options) { if (!is_null($options)) { - $this->loadPassengers($options->passengers); $this->loadSegments($options->segments); diff --git a/src/Amadeus/Client/Struct/Fare/PricePnr13/PricingOptionGroup.php b/src/Amadeus/Client/Struct/Fare/PricePnr13/PricingOptionGroup.php index 3ab009884..46e48355f 100644 --- a/src/Amadeus/Client/Struct/Fare/PricePnr13/PricingOptionGroup.php +++ b/src/Amadeus/Client/Struct/Fare/PricePnr13/PricingOptionGroup.php @@ -99,7 +99,7 @@ class PricingOptionGroup public function __construct($key, $optionDetail=null) { $this->pricingOptionKey = new PricingOptionKey($key); - if(isset($optionDetail)){ + if (isset($optionDetail)){ $this->optionDetail = new OptionDetail($optionDetail); } } From d9fc3702d7e5e6db01e39fe7bb6e21d0a2c61a98 Mon Sep 17 00:00:00 2001 From: Gabriele Date: Thu, 2 Aug 2018 20:29:58 +0200 Subject: [PATCH 18/86] For PullRequest Indentation --- .../Client/Struct/Fare/PricePnr13/PricingOptionGroup.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Amadeus/Client/Struct/Fare/PricePnr13/PricingOptionGroup.php b/src/Amadeus/Client/Struct/Fare/PricePnr13/PricingOptionGroup.php index 46e48355f..89afdc2e2 100644 --- a/src/Amadeus/Client/Struct/Fare/PricePnr13/PricingOptionGroup.php +++ b/src/Amadeus/Client/Struct/Fare/PricePnr13/PricingOptionGroup.php @@ -99,7 +99,7 @@ class PricingOptionGroup public function __construct($key, $optionDetail=null) { $this->pricingOptionKey = new PricingOptionKey($key); - if (isset($optionDetail)){ + if (isset($optionDetail)) { $this->optionDetail = new OptionDetail($optionDetail); } } From 8a1da81233cf2aee1c0f7f1162996d7f211ff95a Mon Sep 17 00:00:00 2001 From: LeoTravel <41335720+LeoTravel@users.noreply.github.com> Date: Thu, 2 Aug 2018 20:54:15 +0200 Subject: [PATCH 19/86] Update composer.json --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 6f9cec231..f02cdf593 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "LeoTravel/amadeus-ws-client", + "name": "amabnl/amadeus-ws-client", "type": "library", "description": "SOAP Web Service client library for interacting with the Amadeus GDS through its SOAP interface", "keywords": ["amadeus", "gds", "service", "webservice", "soap", "wsdl", "client", "xml", "travel", "airline", "hotel", "booking", "car", "rental", "offer", "masterpricer"], @@ -39,4 +39,4 @@ "php": "5.4" } } -} \ No newline at end of file +} From 37683a91a182ff3d31d290de07c2807608ca0d14 Mon Sep 17 00:00:00 2001 From: Gabriele Date: Fri, 3 Aug 2018 12:22:22 +0200 Subject: [PATCH 20/86] fixed composer json, add coverage and throw exeption forpnrwithbookingClass12 --- composer.json | 2 +- .../Fare/PricePNRWithBookingClass12.php | 4 ++ .../Fare/PricePNRWithBookingClass13Test.php | 38 +++++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index f02cdf593..b1a2c081e 100644 --- a/composer.json +++ b/composer.json @@ -39,4 +39,4 @@ "php": "5.4" } } -} +} \ No newline at end of file diff --git a/src/Amadeus/Client/Struct/Fare/PricePNRWithBookingClass12.php b/src/Amadeus/Client/Struct/Fare/PricePNRWithBookingClass12.php index c2845582a..56e43a87b 100644 --- a/src/Amadeus/Client/Struct/Fare/PricePNRWithBookingClass12.php +++ b/src/Amadeus/Client/Struct/Fare/PricePNRWithBookingClass12.php @@ -168,6 +168,10 @@ protected function checkUnsupportedOptions($options) if (!empty($options->pricingLogic)) { throw new OptionNotSupportedException('Pricing Logic option not supported in version 12 or lower'); } + + if (!empty($options->overrideOptionsWithCriteria)) { + throw new OptionNotSupportedException('Override Options With Criteria are not supported in version 12 or lower'); + } } /** diff --git a/tests/Amadeus/Client/Struct/Fare/PricePNRWithBookingClass13Test.php b/tests/Amadeus/Client/Struct/Fare/PricePNRWithBookingClass13Test.php index b5be8048c..76c88c93e 100644 --- a/tests/Amadeus/Client/Struct/Fare/PricePNRWithBookingClass13Test.php +++ b/tests/Amadeus/Client/Struct/Fare/PricePNRWithBookingClass13Test.php @@ -135,6 +135,44 @@ public function testCanDoPricePnrCallWithNewFareBasisParams() $this->assertTrue($this->assertArrayContainsSameObject($msg->pricingOptionGroup, $negofarePo)); } + public function testCanDoPricePnrCallWithOverrideOptionWithCriteriaParams() + { + $opt = new FarePricePnrWithBookingClassOptions([ + 'overrideOptions' => [FarePricePnrWithBookingClassOptions::OVERRIDE_FARETYPE_NEG], + 'validatingCarrier' => 'BA', + 'currencyOverride' => 'EUR', + 'overrideOptionsWithCriteria' => [ + [ + 'key' => 'SBF', + 'optionDetail' => '1' + ] + ] + ]); + + $msg = new PricePNRWithBookingClass13($opt); + + $validatingCarrierPo = new PricingOptionGroup(PricingOptionKey::OPTION_VALIDATING_CARRIER); + $validatingCarrierPo->carrierInformation = new CarrierInformation('BA'); + + $this->assertTrue($this->assertArrayContainsSameObject($msg->pricingOptionGroup, $validatingCarrierPo)); + + $currencyOverridePo = new PricingOptionGroup(PricingOptionKey::OPTION_FARE_CURRENCY_OVERRIDE); + $currencyOverridePo->currency = new Currency('EUR'); + + $this->assertTrue($this->assertArrayContainsSameObject($msg->pricingOptionGroup, $currencyOverridePo)); + + $fareBasisOverridePo = new PricingOptionGroup(PricingOptionKey::OPTION_FARE_BASIS_SIMPLE_OVERRIDE); + $fareBasisOverridePo->optionDetail = new OptionDetail(); + $fareBasisOverridePo->optionDetail->criteriaDetails[] = new CriteriaDetails('QNC469W2'); + $fareBasisOverridePo->paxSegTstReference = new PaxSegTstReference([new PaxSegRef(['type'=> PaxSegRef::TYPE_SEGMENT, 'reference' => 2])]); + + $this->assertTrue($this->assertArrayContainsSameObject($msg->pricingOptionGroup, $fareBasisOverridePo)); + + $negofarePo = new PricingOptionGroup(PricingOptionKey::OPTION_NEGOTIATED_FARES); + + $this->assertTrue($this->assertArrayContainsSameObject($msg->pricingOptionGroup, $negofarePo)); + } + public function testCanDoPricePnrCallWithNoOptions() { $opt = new FarePricePnrWithBookingClassOptions(); From 8a0f3604813372f7ddb4bb827a413adac96e3a98 Mon Sep 17 00:00:00 2001 From: Gabriele Date: Fri, 3 Aug 2018 12:58:00 +0200 Subject: [PATCH 21/86] i hope for the best with coverage! --- .../Fare/PricePNRWithBookingClass12Test.php | 19 +++++++++++++++++++ .../Fare/PricePNRWithBookingClass13Test.php | 10 +--------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/tests/Amadeus/Client/Struct/Fare/PricePNRWithBookingClass12Test.php b/tests/Amadeus/Client/Struct/Fare/PricePNRWithBookingClass12Test.php index 4b9f98bfb..416365606 100644 --- a/tests/Amadeus/Client/Struct/Fare/PricePNRWithBookingClass12Test.php +++ b/tests/Amadeus/Client/Struct/Fare/PricePNRWithBookingClass12Test.php @@ -145,6 +145,25 @@ public function testCanThrowExceptioWhenDoPricePnrCallWithPricingLogic() new PricePNRWithBookingClass12($opt); } + public function testCanThrowExceptioWhenDoPricePnrCallWithOverrideOptionsWithCriteria() + { + $this->setExpectedException( + '\Amadeus\Client\Struct\OptionNotSupportedException', + 'Override Options With Criteria are not supported in version 12 or lower' + ); + + $opt = new FarePricePnrWithBookingClassOptions([ + 'overrideOptionsWithCriteria' => [ + [ + 'key' => 'SBF', + 'optionDetail' => '1' + ] + ] + ]); + + new PricePNRWithBookingClass12($opt); + } + public function testCanDoPricePnrCallWithCorpNegoFare() { $opt = new FarePricePnrWithBookingClassOptions([ diff --git a/tests/Amadeus/Client/Struct/Fare/PricePNRWithBookingClass13Test.php b/tests/Amadeus/Client/Struct/Fare/PricePNRWithBookingClass13Test.php index 76c88c93e..c62b22b24 100644 --- a/tests/Amadeus/Client/Struct/Fare/PricePNRWithBookingClass13Test.php +++ b/tests/Amadeus/Client/Struct/Fare/PricePNRWithBookingClass13Test.php @@ -138,7 +138,6 @@ public function testCanDoPricePnrCallWithNewFareBasisParams() public function testCanDoPricePnrCallWithOverrideOptionWithCriteriaParams() { $opt = new FarePricePnrWithBookingClassOptions([ - 'overrideOptions' => [FarePricePnrWithBookingClassOptions::OVERRIDE_FARETYPE_NEG], 'validatingCarrier' => 'BA', 'currencyOverride' => 'EUR', 'overrideOptionsWithCriteria' => [ @@ -161,14 +160,7 @@ public function testCanDoPricePnrCallWithOverrideOptionWithCriteriaParams() $this->assertTrue($this->assertArrayContainsSameObject($msg->pricingOptionGroup, $currencyOverridePo)); - $fareBasisOverridePo = new PricingOptionGroup(PricingOptionKey::OPTION_FARE_BASIS_SIMPLE_OVERRIDE); - $fareBasisOverridePo->optionDetail = new OptionDetail(); - $fareBasisOverridePo->optionDetail->criteriaDetails[] = new CriteriaDetails('QNC469W2'); - $fareBasisOverridePo->paxSegTstReference = new PaxSegTstReference([new PaxSegRef(['type'=> PaxSegRef::TYPE_SEGMENT, 'reference' => 2])]); - - $this->assertTrue($this->assertArrayContainsSameObject($msg->pricingOptionGroup, $fareBasisOverridePo)); - - $negofarePo = new PricingOptionGroup(PricingOptionKey::OPTION_NEGOTIATED_FARES); + $negofarePo = new PricingOptionGroup('SBF','1'); $this->assertTrue($this->assertArrayContainsSameObject($msg->pricingOptionGroup, $negofarePo)); } From 227bfc4c607715f3ce6cd31cab9301e1e31f3390 Mon Sep 17 00:00:00 2001 From: "arvind.p" Date: Sat, 4 Aug 2018 18:56:53 +0530 Subject: [PATCH 22/86] new message serviceStandaloneCatalogue --- src/Amadeus/Client.php | 20 +++ .../Service/StandaloneCatalogueConv.php | 45 +++++++ .../Service/StandaloneCatalogue/Passenger.php | 61 +++++++++ .../StandaloneCatalogue/Passenger.php~ | 61 +++++++++ .../StandaloneCatalogue/PricingOptions.php | 41 ++++++ .../StandaloneCatalogue/PricingOptions.php~ | 41 ++++++ .../Service/StandaloneCatalogue/Segment.php | 106 +++++++++++++++ .../Service/StandaloneCatalogue/Segment.php~ | 106 +++++++++++++++ .../ServiceStandaloneCatalogueOptions.php | 40 ++++++ .../Struct/Service/IntegratedPricing.php | 39 +++++- .../IntegratedPricing/PricingOptionKey.php | 1 + .../Service/StandaloneCatalogue/FareInfo.php | 43 ++++++ .../StandaloneCatalogue/FlightInfo.php | 124 ++++++++++++++++++ .../PassengerInfoGroup.php | 60 +++++++++ .../SegmentInformation.php | 66 ++++++++++ .../SpecificTravellerDetails.php | 49 +++++++ .../StandaloneCatalogue/TravellerDetails.php | 47 +++++++ 17 files changed, 949 insertions(+), 1 deletion(-) create mode 100755 src/Amadeus/Client/RequestCreator/Converter/Service/StandaloneCatalogueConv.php create mode 100755 src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/Passenger.php create mode 100755 src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/Passenger.php~ create mode 100755 src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/PricingOptions.php create mode 100755 src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/PricingOptions.php~ create mode 100755 src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/Segment.php create mode 100755 src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/Segment.php~ create mode 100755 src/Amadeus/Client/RequestOptions/ServiceStandaloneCatalogueOptions.php create mode 100755 src/Amadeus/Client/Struct/Service/StandaloneCatalogue/FareInfo.php create mode 100755 src/Amadeus/Client/Struct/Service/StandaloneCatalogue/FlightInfo.php create mode 100755 src/Amadeus/Client/Struct/Service/StandaloneCatalogue/PassengerInfoGroup.php create mode 100755 src/Amadeus/Client/Struct/Service/StandaloneCatalogue/SegmentInformation.php create mode 100755 src/Amadeus/Client/Struct/Service/StandaloneCatalogue/SpecificTravellerDetails.php create mode 100755 src/Amadeus/Client/Struct/Service/StandaloneCatalogue/TravellerDetails.php diff --git a/src/Amadeus/Client.php b/src/Amadeus/Client.php index df7d758cd..02cbd3c00 100644 --- a/src/Amadeus/Client.php +++ b/src/Amadeus/Client.php @@ -1564,6 +1564,26 @@ public function serviceIntegratedCatalogue( return $this->callMessage($msgName, $options, $messageOptions); } + /** + * Service_StandaloneCatalogue + * + * @param RequestOptions\ServiceStandaloneCatalogueOptions $options + * @param array $messageOptions (OPTIONAL) + * @return Result + * @throws Client\InvalidMessageException + * @throws Client\RequestCreator\MessageVersionUnsupportedException + * @throws Exception + */ + public function serviceStandaloneCatalogue( + RequestOptions\ServiceStandaloneCatalogueOptions $options, + $messageOptions = [] + + ) { + $msgName = 'Service_StandaloneCatalogue'; + + return $this->callMessage($msgName, $options, $messageOptions); + } + /** * Call a message with the given parameters * diff --git a/src/Amadeus/Client/RequestCreator/Converter/Service/StandaloneCatalogueConv.php b/src/Amadeus/Client/RequestCreator/Converter/Service/StandaloneCatalogueConv.php new file mode 100755 index 000000000..6ff340efa --- /dev/null +++ b/src/Amadeus/Client/RequestCreator/Converter/Service/StandaloneCatalogueConv.php @@ -0,0 +1,45 @@ + + */ +class StandaloneCatalogueConv extends BaseConverter +{ + /** + * @param ServiceIntegratedCatalogueOptions $requestOptions + * @param int|string $version + * @return Struct\Service\StandaloneCatalogue + */ + public function convert($requestOptions, $version) + { + return new Struct\Service\StandaloneCatalogue($requestOptions); + } +} diff --git a/src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/Passenger.php b/src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/Passenger.php new file mode 100755 index 000000000..e3027d540 --- /dev/null +++ b/src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/Passenger.php @@ -0,0 +1,61 @@ + + */ +class Passenger extends LoadParamsFromArray +{ + const TYPE_ADULT = "ADT"; + + const TYPE_CHILD = "CH"; + + const TYPE_INFANT = "INF"; + + const TYPE_INFANT_WITH_SEAT = "INS"; + + /** + * What type of passengers? + * + * @see self::TYPE_* + * @var string + */ + public $type; + + /** + * List of _unique_ identifiers for these passengers. + * + * If you have 3 passengers of this type, you need to provide 3 unique tattoos. + * + * For infants in a seat with an adult, you must provide the ID of the adult as their tattoo. + * + * @var int[] + */ + public $tattoos = []; +} diff --git a/src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/Passenger.php~ b/src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/Passenger.php~ new file mode 100755 index 000000000..e3027d540 --- /dev/null +++ b/src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/Passenger.php~ @@ -0,0 +1,61 @@ + + */ +class Passenger extends LoadParamsFromArray +{ + const TYPE_ADULT = "ADT"; + + const TYPE_CHILD = "CH"; + + const TYPE_INFANT = "INF"; + + const TYPE_INFANT_WITH_SEAT = "INS"; + + /** + * What type of passengers? + * + * @see self::TYPE_* + * @var string + */ + public $type; + + /** + * List of _unique_ identifiers for these passengers. + * + * If you have 3 passengers of this type, you need to provide 3 unique tattoos. + * + * For infants in a seat with an adult, you must provide the ID of the adult as their tattoo. + * + * @var int[] + */ + public $tattoos = []; +} diff --git a/src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/PricingOptions.php b/src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/PricingOptions.php new file mode 100755 index 000000000..4d24cff1f --- /dev/null +++ b/src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/PricingOptions.php @@ -0,0 +1,41 @@ + + */ +class PricingOptions extends ServiceIntegratedPricingOptions +{ + + /** + * Provide a fare basis to price with + * + * @var FareBasis[] + */ + public $pricingsFareBasis = []; +} diff --git a/src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/PricingOptions.php~ b/src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/PricingOptions.php~ new file mode 100755 index 000000000..4d24cff1f --- /dev/null +++ b/src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/PricingOptions.php~ @@ -0,0 +1,41 @@ + + */ +class PricingOptions extends ServiceIntegratedPricingOptions +{ + + /** + * Provide a fare basis to price with + * + * @var FareBasis[] + */ + public $pricingsFareBasis = []; +} diff --git a/src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/Segment.php b/src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/Segment.php new file mode 100755 index 000000000..6e4251fc9 --- /dev/null +++ b/src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/Segment.php @@ -0,0 +1,106 @@ + + */ +class Segment extends LoadParamsFromArray +{ + /** + * Departure date & time + * + * @var \DateTime + */ + public $departureDate; + + /** + * Arrival date & time + * + * @var \DateTime + */ + public $arrivalDate; + + /** + * Departure IATA code + * + * @var string + */ + public $from; + + /** + * Destination IATA code + * + * @var string + */ + public $to; + + /** + * Marketing airline code + * + * @var string + */ + public $marketingCompany; + + /** + * Operating airline code + * + * @var string + */ + public $operatingCompany; + + /** + * Flight number + * + * @var string + */ + public $flightNumber; + + /** + * Booking Class code + * + * @var string + */ + public $bookingClass; + + /** + * The number of stops + * + * @var int + */ + public $flightIndicator; + + /** + * Unique segment tattoo ID. + * + * @var int + */ + public $segmentTattoo; + + +} diff --git a/src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/Segment.php~ b/src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/Segment.php~ new file mode 100755 index 000000000..6e4251fc9 --- /dev/null +++ b/src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/Segment.php~ @@ -0,0 +1,106 @@ + + */ +class Segment extends LoadParamsFromArray +{ + /** + * Departure date & time + * + * @var \DateTime + */ + public $departureDate; + + /** + * Arrival date & time + * + * @var \DateTime + */ + public $arrivalDate; + + /** + * Departure IATA code + * + * @var string + */ + public $from; + + /** + * Destination IATA code + * + * @var string + */ + public $to; + + /** + * Marketing airline code + * + * @var string + */ + public $marketingCompany; + + /** + * Operating airline code + * + * @var string + */ + public $operatingCompany; + + /** + * Flight number + * + * @var string + */ + public $flightNumber; + + /** + * Booking Class code + * + * @var string + */ + public $bookingClass; + + /** + * The number of stops + * + * @var int + */ + public $flightIndicator; + + /** + * Unique segment tattoo ID. + * + * @var int + */ + public $segmentTattoo; + + +} diff --git a/src/Amadeus/Client/RequestOptions/ServiceStandaloneCatalogueOptions.php b/src/Amadeus/Client/RequestOptions/ServiceStandaloneCatalogueOptions.php new file mode 100755 index 000000000..96fb2a5cf --- /dev/null +++ b/src/Amadeus/Client/RequestOptions/ServiceStandaloneCatalogueOptions.php @@ -0,0 +1,40 @@ + + */ +class ServiceStandaloneCatalogueOptions extends Base +{ + public $passengers = []; + + public $segments = []; + + public $pricingOptions; +} + + +?> \ No newline at end of file diff --git a/src/Amadeus/Client/Struct/Service/IntegratedPricing.php b/src/Amadeus/Client/Struct/Service/IntegratedPricing.php index 532b19891..7cf04eca9 100644 --- a/src/Amadeus/Client/Struct/Service/IntegratedPricing.php +++ b/src/Amadeus/Client/Struct/Service/IntegratedPricing.php @@ -36,6 +36,7 @@ use Amadeus\Client\Struct\Fare\PricePnr13\LocationInformation; use Amadeus\Client\Struct\Fare\PricePnr13\OptionDetail; use Amadeus\Client\Struct\Fare\PricePnr13\PaxSegTstReference; +use Amadeus\Client\Struct\Fare\PricePnr13\PricingOptionGroup; use Amadeus\Client\Struct\Service\IntegratedPricing\PricingOptionKey; use Amadeus\Client\Struct\Service\IntegratedPricing\PricingOption; @@ -68,10 +69,15 @@ public function __construct($options = null) * @param ServiceIntegratedPricingOptions|ServiceIntegratedCatalogueOptions $options * @return PricingOption[] */ - protected function loadPricingOptions($options) + public static function loadPricingOptions($options) { $priceOptions = []; + $priceOptions = self::mergeOptions( + $priceOptions, + self::makePricingOptionFareBasisOverride($options->pricingsFareBasis) + ); + $priceOptions = self::mergeOptions( $priceOptions, self::makePricingOptionForValidatingCarrier($options->validatingCarrier) @@ -155,6 +161,37 @@ protected function loadPricingOptions($options) return $priceOptions; } + + /** + * @param FareBasis[] $pricingsFareBasis + * @return PricingOptionGroup[] + */ + protected static function makePricingOptionFareBasisOverride($pricingsFareBasis) + { + $opt = []; + + if ($pricingsFareBasis !== null) { + foreach ($pricingsFareBasis as $pricingFareBasis) { + $po = new PricingOptionGroup(PricingOptionKey::OPTION_FARE_BASIS_SIMPLE_OVERRIDE); + + //Support for legacy fareBasisPrimaryCode to be removed when breaking BC: + $po->optionDetail = new OptionDetail( + $pricingFareBasis->fareBasisPrimaryCode.$pricingFareBasis->fareBasisCode + ); + + //Support for legacy segmentReference to be removed when breaking BC: + $po->paxSegTstReference = new PaxSegTstReference( + $pricingFareBasis->references, + $pricingFareBasis->segmentReference + ); + + $opt[] = $po; + } + } + + return $opt; + } + /** * @param string|null $validatingCarrier diff --git a/src/Amadeus/Client/Struct/Service/IntegratedPricing/PricingOptionKey.php b/src/Amadeus/Client/Struct/Service/IntegratedPricing/PricingOptionKey.php index 2fdbb0cb0..3abb22d99 100644 --- a/src/Amadeus/Client/Struct/Service/IntegratedPricing/PricingOptionKey.php +++ b/src/Amadeus/Client/Struct/Service/IntegratedPricing/PricingOptionKey.php @@ -30,6 +30,7 @@ */ class PricingOptionKey { + const OPTION_FARE_BASIS_SIMPLE_OVERRIDE = "FBA"; const OVERRIDE_ACCOUNT_CODE = "ACC"; const OVERRIDE_PRICING_ALL_SERVICES = "ALL"; const OVERRIDE_AWARD = "AWD"; diff --git a/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/FareInfo.php b/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/FareInfo.php new file mode 100755 index 000000000..bcabf8243 --- /dev/null +++ b/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/FareInfo.php @@ -0,0 +1,43 @@ + + */ +class FareInfo +{ + /** + * @var string + */ + public $valueQualifier; + + + public function __construct($paxType) + { + $this->valueQualifier = $paxType; + } +} diff --git a/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/FlightInfo.php b/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/FlightInfo.php new file mode 100755 index 000000000..da1028cf4 --- /dev/null +++ b/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/FlightInfo.php @@ -0,0 +1,124 @@ + + */ +class FlightInfo +{ + /** + * @var SegmentInformation + */ + public $flightDetails; + + /** + * @var AdditionalSegmentDetails + */ + public $additionnalSegmentDetails; + + /** + * @var Inventory + */ + public $inventory; + + /** + * SegmentGroup constructor. + * + * @param Segment $options + */ + public function __construct($options) + { + $this->flightDetails = new SegmentInformation( + $options->segmentTattoo, + $options->departureDate, + $options->from, + $options->to, + $options->marketingCompany, + $options->flightNumber, + $options->bookingClass + ); + + $this->loadOptionalSegmentInformation($options); + + $this->loadInventory($options->inventory); + } + + /** + * Load non-required options if available + * + * @param Segment $options + */ + protected function loadOptionalSegmentInformation($options) + { + if (!empty($options->operatingCompany)) { + $this->flightDetails->companyDetails->operatingCompany = $options->operatingCompany; + } + + if ($options->arrivalDate instanceof \DateTime) { + $this->flightDetails->flightDate->setArrivalDate($options->arrivalDate); + } + + if (!empty($options->groupNumber)) { + $this->flightDetails->flightTypeDetails = new FlightTypeDetails($options->groupNumber); + } + + $this->loadAdditionalSegmentDetails($options->airplaneCode, $options->nrOfStops); + } + + /** + * @param string|null $airplaneCode + * @param int|null $nrOfStops + */ + protected function loadAdditionalSegmentDetails($airplaneCode, $nrOfStops) + { + if (!empty($airplaneCode) || !empty($nrOfStops)) { + $this->additionalFlightInfo = new AdditionalSegmentDetails($airplaneCode, $nrOfStops); + } + } + + /** + * Load inventory information + * + * @param array $inventory + */ + protected function loadInventory($inventory) + { + if (is_array($inventory) && count($inventory) > 0) { + $this->inventory = new Inventory(); + + foreach ($inventory as $bookingClass => $availabilityAmount) { + $this->inventory->bookingClassDetails[] = new BookingClassDetails( + $bookingClass, + $availabilityAmount + ); + } + } + } +} diff --git a/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/PassengerInfoGroup.php b/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/PassengerInfoGroup.php new file mode 100755 index 000000000..57da2a17d --- /dev/null +++ b/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/PassengerInfoGroup.php @@ -0,0 +1,60 @@ + + */ +class PassengerInfoGroup +{ + /** + * @var specificTravellerDetails + */ + public $specificTravellerDetails; + + + /** + * @var fareInfo + */ + public $fareInfo; + + /** + * PassengersGroup constructor. + * + * @param Passenger $passenger + * @param int $group + */ + public function __construct($passenger, $referenceNumber) + { + $this->specificTravellerDetails = new SpecificTravellerDetails($referenceNumber); + + if (!empty($passenger->type)) { + $this->fareInfo = new FareInfo($passenger->type); + } + } +} diff --git a/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/SegmentInformation.php b/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/SegmentInformation.php new file mode 100755 index 000000000..74bbeafac --- /dev/null +++ b/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/SegmentInformation.php @@ -0,0 +1,66 @@ + + */ +class SegmentInformation extends TravelProductInformation +{ + /** + * @var int + */ + public $itemNumber; + + /** + * SegmentInformation constructor. + * + * @param int $itemNumber + * @param \DateTime $departureDate + * @param string $from + * @param string $to + * @param string $company + * @param string $flightNumber + * @param string $bookingClass + */ + public function __construct( + $itemNumber, + \DateTime $departureDate, + $from, + $to, + $company, + $flightNumber, + $bookingClass + ) { + $this->itemNumber = $itemNumber; + + parent::__construct($departureDate, $from, $to, $company, $flightNumber, $bookingClass); + } +} diff --git a/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/SpecificTravellerDetails.php b/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/SpecificTravellerDetails.php new file mode 100755 index 000000000..1c2698cf5 --- /dev/null +++ b/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/SpecificTravellerDetails.php @@ -0,0 +1,49 @@ + + */ +class SpecificTravellerDetails +{ + /** + * @var specificTravellerDetails[] + */ + public $travellerDetails; + + /** + * segmentControlDetails constructor. + * + * @param int $referenceNumber + */ + public function __construct($referenceNumber) + { + $this->travellerDetails = new TravellerDetails( + $referenceNumber + ); + } +} diff --git a/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/TravellerDetails.php b/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/TravellerDetails.php new file mode 100755 index 000000000..e61acc1b8 --- /dev/null +++ b/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/TravellerDetails.php @@ -0,0 +1,47 @@ + + */ +class TravellerDetails +{ + /** + * @var int + */ + public $referenceNumber; + + /** + * TravellerDetails constructor. + * + * @param int $referenceNumber + */ + public function __construct($referenceNumber) + { + $this->referenceNumber = $referenceNumber; + } +} From d08bfe914e0d0fbd53deaac03beeaef3a13d3203 Mon Sep 17 00:00:00 2001 From: arvind-pandey <40858867+arvind-pandey@users.noreply.github.com> Date: Sat, 4 Aug 2018 19:02:18 +0530 Subject: [PATCH 23/86] Update list-of-supported-messages.rst - Service_StandaloneCatalogue Message is added --- docs/list-of-supported-messages.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/list-of-supported-messages.rst b/docs/list-of-supported-messages.rst index 5af3b9347..37151cf88 100644 --- a/docs/list-of-supported-messages.rst +++ b/docs/list-of-supported-messages.rst @@ -65,6 +65,7 @@ This is the list of messages that are at least partially supported at this time: - DocRefund_IgnoreRefund - Service_IntegratedPricing - Service_IntegratedCatalogue +- Service_StandaloneCatalogue - Offer_CreateOffer - Offer_VerifyOffer - Offer_ConfirmAirOffer @@ -103,7 +104,6 @@ These messages will be implemented at some point in the future. *Pull requests a - Media_GetMedia - Service_PriceServiceViaCatalogue - Service_PriceIntegratedMode -- Service_StandaloneCatalogue - Service_StandalonePricing - Hotel_MultiSingleAvailability (see `issue 70 `_) - Hotel_DescriptiveInfo (see `issue 70 `_) From a06dcbef87e01f2fef5dcf9f20d4918ed97bb96c Mon Sep 17 00:00:00 2001 From: arvind-pandey <40858867+arvind-pandey@users.noreply.github.com> Date: Sat, 4 Aug 2018 19:08:26 +0530 Subject: [PATCH 24/86] Update samples.rst New Message Service_StandaloneCatalogue implementation --- docs/samples.rst | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/docs/samples.rst b/docs/samples.rst index b02d069ec..a7e7db8fe 100644 --- a/docs/samples.rst +++ b/docs/samples.rst @@ -3195,6 +3195,50 @@ All the examples for ``Service_IntegratedPricing`` (see above) should also work ] ]) ); + +--------------------------- +Service_IntegratedCatalogue +--------------------------- + +.. code-block:: php + + use Amadeus\Client\RequestOptions\ServiceStandaloneCatalogueOptions; + use Amadeus\Client\RequestOptions\Service\StandaloneCatalogue\Passenger as servicePassenger; + use Amadeus\Client\RequestOptions\Service\StandaloneCatalogue\Segment as serviceSegment; + use Amadeus\Client\RequestOptions\Service\StandaloneCatalogue\PricingOptions; + use Amadeus\Client\RequestOptions\Fare\PricePnr\FareBasis; + + $standaloneCatalogueResponse = $client->serviceStandaloneCatalogue( + new ServiceStandaloneCatalogueOptions([ + 'passengers' => [ + new servicePassenger([ + 'tattoos' => [1, 2], + 'type' => Passenger::TYPE_ADULT + ]) + ], + 'segments' => [ + new serviceSegment([ + 'departureDate' => \DateTime::createFromFormat('Y-m-d H:i:s', '2018-07-31 12:55:00'), + 'arrivalDate' => \DateTime::createFromFormat('Y-m-d H:i:s', '2018-07-31 15:10:00'), + 'from' => 'CAI', + 'to' => 'TUN', + 'marketingCompany' => 'TU', + 'operatingCompany' => 'TU', + 'flightNumber' => '814', + 'bookingClass' => 'L', + 'flightIndicator' => 'L', + 'segmentTattoo' => 1 + ]) + ], + 'pricingOptions' => new PricingOptions([ + 'pricingsFareBasis' => [ + new FareBasis([ + 'fareBasisCode' => 'LOXOW', + ]) + ] + ]) + ]) +); *** FOP From 028098019c43efe9082c294a68ea37730f1e3edc Mon Sep 17 00:00:00 2001 From: arvind-pandey <40858867+arvind-pandey@users.noreply.github.com> Date: Sat, 4 Aug 2018 19:10:08 +0530 Subject: [PATCH 25/86] Update samples.rst ServiceStandaloneCatalogue Changes --- docs/samples.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/samples.rst b/docs/samples.rst index a7e7db8fe..0b040b393 100644 --- a/docs/samples.rst +++ b/docs/samples.rst @@ -3197,7 +3197,7 @@ All the examples for ``Service_IntegratedPricing`` (see above) should also work ); --------------------------- -Service_IntegratedCatalogue +Service_StandaloneCatalogue --------------------------- .. code-block:: php From d9c475a535327867349d9a647f0c8e502e045f8b Mon Sep 17 00:00:00 2001 From: "arvind.p" Date: Mon, 6 Aug 2018 17:37:24 +0530 Subject: [PATCH 26/86] changes --- .../Service/StandaloneCatalogue/Passenger.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/Passenger.php b/src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/Passenger.php index e3027d540..cec6e55a8 100755 --- a/src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/Passenger.php +++ b/src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/Passenger.php @@ -49,13 +49,11 @@ class Passenger extends LoadParamsFromArray public $type; /** - * List of _unique_ identifiers for these passengers. + * Specifies the passenger index * - * If you have 3 passengers of this type, you need to provide 3 unique tattoos. + * If you have 3 passengers of this type, you need to provide 3 unique passenger index. * - * For infants in a seat with an adult, you must provide the ID of the adult as their tattoo. - * - * @var int[] + * @var int */ - public $tattoos = []; + public $reference; } From acf7fa25c95e3483860f0312308b9c6f192c4a34 Mon Sep 17 00:00:00 2001 From: "arvind.p" Date: Mon, 6 Aug 2018 17:46:50 +0530 Subject: [PATCH 27/86] change --- .../RequestCreator/Converter/Service/StandaloneCatalogueConv.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Amadeus/Client/RequestCreator/Converter/Service/StandaloneCatalogueConv.php b/src/Amadeus/Client/RequestCreator/Converter/Service/StandaloneCatalogueConv.php index 6ff340efa..b99381eb6 100755 --- a/src/Amadeus/Client/RequestCreator/Converter/Service/StandaloneCatalogueConv.php +++ b/src/Amadeus/Client/RequestCreator/Converter/Service/StandaloneCatalogueConv.php @@ -21,6 +21,7 @@ */ namespace Amadeus\Client\RequestCreator\Converter\Service; + use Amadeus\Client\RequestCreator\Converter\BaseConverter; use Amadeus\Client\RequestOptions\ServiceStandaloneCatalogueOptions; use Amadeus\Client\Struct; From 4bcb1416ad0433eb607f50602825d59d4e7bd82c Mon Sep 17 00:00:00 2001 From: "arvind.p" Date: Mon, 6 Aug 2018 17:57:58 +0530 Subject: [PATCH 28/86] change --- .../Service/StandaloneCatalogue/PricingOptions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/PricingOptions.php b/src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/PricingOptions.php index 4d24cff1f..2f7cf0224 100755 --- a/src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/PricingOptions.php +++ b/src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/PricingOptions.php @@ -20,6 +20,7 @@ * @license https://opensource.org/licenses/Apache-2.0 Apache 2.0 */ namespace Amadeus\Client\RequestOptions\Service\StandaloneCatalogue; + use Amadeus\Client\RequestOptions\ServiceIntegratedPricingOptions; /** * Pricing Options for the Fare_InformativePricingWithoutPNR message @@ -30,8 +31,7 @@ * @author Arvind Pandey */ class PricingOptions extends ServiceIntegratedPricingOptions -{ - +{ /** * Provide a fare basis to price with * From 4616da48d35ae3c1ea0555c33067af9e3b938231 Mon Sep 17 00:00:00 2001 From: "arvind.p" Date: Mon, 6 Aug 2018 19:03:32 +0530 Subject: [PATCH 29/86] changes --- .../Service/StandaloneCatalogue/Segment.php | 106 ------------------ .../StandaloneCatalogue/FlightInfo.php | 9 +- .../PassengerInfoGroup.php | 6 +- .../SegmentInformation.php | 66 ----------- .../SpecificTravellerDetails.php | 4 +- .../StandaloneCatalogue/TravellerDetails.php | 2 +- 6 files changed, 11 insertions(+), 182 deletions(-) delete mode 100755 src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/Segment.php delete mode 100755 src/Amadeus/Client/Struct/Service/StandaloneCatalogue/SegmentInformation.php diff --git a/src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/Segment.php b/src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/Segment.php deleted file mode 100755 index 6e4251fc9..000000000 --- a/src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/Segment.php +++ /dev/null @@ -1,106 +0,0 @@ - - */ -class Segment extends LoadParamsFromArray -{ - /** - * Departure date & time - * - * @var \DateTime - */ - public $departureDate; - - /** - * Arrival date & time - * - * @var \DateTime - */ - public $arrivalDate; - - /** - * Departure IATA code - * - * @var string - */ - public $from; - - /** - * Destination IATA code - * - * @var string - */ - public $to; - - /** - * Marketing airline code - * - * @var string - */ - public $marketingCompany; - - /** - * Operating airline code - * - * @var string - */ - public $operatingCompany; - - /** - * Flight number - * - * @var string - */ - public $flightNumber; - - /** - * Booking Class code - * - * @var string - */ - public $bookingClass; - - /** - * The number of stops - * - * @var int - */ - public $flightIndicator; - - /** - * Unique segment tattoo ID. - * - * @var int - */ - public $segmentTattoo; - - -} diff --git a/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/FlightInfo.php b/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/FlightInfo.php index da1028cf4..1b22ab905 100755 --- a/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/FlightInfo.php +++ b/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/FlightInfo.php @@ -22,14 +22,15 @@ namespace Amadeus\Client\Struct\Service\StandaloneCatalogue; -use Amadeus\Client\RequestOptions\Service\StandaloneCatalogue\Segment; +use Amadeus\Client\RequestOptions\Fare\InformativePricing\Segment; +use Amadeus\Client\Struct\Fare\InformativePricing13\SegmentInformation; use Amadeus\Client\Struct\Air\FlightTypeDetails; /** - * SegmentGroup + * FlightInfo * - * @package Amadeus\Client\Struct\Fare\InformativePricing13 - * @author Dieter Devlieghere + * @package Amadeus\Client\Struct\Service\StandaloneCatalogue + * @author Arvind Pandey */ class FlightInfo { diff --git a/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/PassengerInfoGroup.php b/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/PassengerInfoGroup.php index 57da2a17d..1b0294ad6 100755 --- a/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/PassengerInfoGroup.php +++ b/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/PassengerInfoGroup.php @@ -22,13 +22,13 @@ namespace Amadeus\Client\Struct\Service\StandaloneCatalogue; -use Amadeus\Client\RequestOptions\Service\StandaloneCatalogue\Passenger; +use Amadeus\Client\Struct\Service\StandaloneCatalogue\Passenger; /** * PassengersGroup * - * @package Amadeus\Client\Struct\Fare\InformativePricing13 - * @author Dieter Devlieghere + * @package Amadeus\Client\Struct\Service\StandaloneCatalogue + * @author Arvind Pandey */ class PassengerInfoGroup { diff --git a/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/SegmentInformation.php b/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/SegmentInformation.php deleted file mode 100755 index 74bbeafac..000000000 --- a/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/SegmentInformation.php +++ /dev/null @@ -1,66 +0,0 @@ - - */ -class SegmentInformation extends TravelProductInformation -{ - /** - * @var int - */ - public $itemNumber; - - /** - * SegmentInformation constructor. - * - * @param int $itemNumber - * @param \DateTime $departureDate - * @param string $from - * @param string $to - * @param string $company - * @param string $flightNumber - * @param string $bookingClass - */ - public function __construct( - $itemNumber, - \DateTime $departureDate, - $from, - $to, - $company, - $flightNumber, - $bookingClass - ) { - $this->itemNumber = $itemNumber; - - parent::__construct($departureDate, $from, $to, $company, $flightNumber, $bookingClass); - } -} diff --git a/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/SpecificTravellerDetails.php b/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/SpecificTravellerDetails.php index 1c2698cf5..fbaf65d0f 100755 --- a/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/SpecificTravellerDetails.php +++ b/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/SpecificTravellerDetails.php @@ -23,10 +23,10 @@ namespace Amadeus\Client\Struct\Service\StandaloneCatalogue; /** - * SegmentRepetitionControl + * SpecificTravellerDetails * * @package Amadeus\Client\Struct\Service\StandaloneCatalogue - * @author Dieter Devlieghere + * @author Arvind Pandey */ class SpecificTravellerDetails { diff --git a/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/TravellerDetails.php b/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/TravellerDetails.php index e61acc1b8..9280efa9e 100755 --- a/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/TravellerDetails.php +++ b/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/TravellerDetails.php @@ -26,7 +26,7 @@ * TravellerDetails * * @package Amadeus\Client\Struct\Service\StandaloneCatalogue - * @author Dieter Devlieghere + * @author Arvind Pandey */ class TravellerDetails { From 16c67c95a45ea86677d594074547410edab9d156 Mon Sep 17 00:00:00 2001 From: "arvind.p" Date: Mon, 6 Aug 2018 19:10:54 +0530 Subject: [PATCH 30/86] deleted --- .../StandaloneCatalogue/Passenger.php~ | 61 ---------- .../StandaloneCatalogue/PricingOptions.php~ | 41 ------- .../Service/StandaloneCatalogue/Segment.php~ | 106 ------------------ 3 files changed, 208 deletions(-) delete mode 100755 src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/Passenger.php~ delete mode 100755 src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/PricingOptions.php~ delete mode 100755 src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/Segment.php~ diff --git a/src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/Passenger.php~ b/src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/Passenger.php~ deleted file mode 100755 index e3027d540..000000000 --- a/src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/Passenger.php~ +++ /dev/null @@ -1,61 +0,0 @@ - - */ -class Passenger extends LoadParamsFromArray -{ - const TYPE_ADULT = "ADT"; - - const TYPE_CHILD = "CH"; - - const TYPE_INFANT = "INF"; - - const TYPE_INFANT_WITH_SEAT = "INS"; - - /** - * What type of passengers? - * - * @see self::TYPE_* - * @var string - */ - public $type; - - /** - * List of _unique_ identifiers for these passengers. - * - * If you have 3 passengers of this type, you need to provide 3 unique tattoos. - * - * For infants in a seat with an adult, you must provide the ID of the adult as their tattoo. - * - * @var int[] - */ - public $tattoos = []; -} diff --git a/src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/PricingOptions.php~ b/src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/PricingOptions.php~ deleted file mode 100755 index 4d24cff1f..000000000 --- a/src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/PricingOptions.php~ +++ /dev/null @@ -1,41 +0,0 @@ - - */ -class PricingOptions extends ServiceIntegratedPricingOptions -{ - - /** - * Provide a fare basis to price with - * - * @var FareBasis[] - */ - public $pricingsFareBasis = []; -} diff --git a/src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/Segment.php~ b/src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/Segment.php~ deleted file mode 100755 index 6e4251fc9..000000000 --- a/src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/Segment.php~ +++ /dev/null @@ -1,106 +0,0 @@ - - */ -class Segment extends LoadParamsFromArray -{ - /** - * Departure date & time - * - * @var \DateTime - */ - public $departureDate; - - /** - * Arrival date & time - * - * @var \DateTime - */ - public $arrivalDate; - - /** - * Departure IATA code - * - * @var string - */ - public $from; - - /** - * Destination IATA code - * - * @var string - */ - public $to; - - /** - * Marketing airline code - * - * @var string - */ - public $marketingCompany; - - /** - * Operating airline code - * - * @var string - */ - public $operatingCompany; - - /** - * Flight number - * - * @var string - */ - public $flightNumber; - - /** - * Booking Class code - * - * @var string - */ - public $bookingClass; - - /** - * The number of stops - * - * @var int - */ - public $flightIndicator; - - /** - * Unique segment tattoo ID. - * - * @var int - */ - public $segmentTattoo; - - -} From d2bc03c4da7847475b7d237d9ff784f06c2770a8 Mon Sep 17 00:00:00 2001 From: "arvind.p" Date: Tue, 7 Aug 2018 19:15:20 +0530 Subject: [PATCH 31/86] change --- .../Service/StandaloneCatalogue/FlightInfo.php | 2 +- .../StandaloneCatalogue/PassengerInfoGroup.php | 14 ++++++++------ .../SpecificTravellerDetails.php | 8 ++++---- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/FlightInfo.php b/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/FlightInfo.php index 1b22ab905..12663ce69 100755 --- a/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/FlightInfo.php +++ b/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/FlightInfo.php @@ -35,7 +35,7 @@ class FlightInfo { /** - * @var SegmentInformation + * @var flightDetails */ public $flightDetails; diff --git a/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/PassengerInfoGroup.php b/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/PassengerInfoGroup.php index 1b0294ad6..ac5289e9c 100755 --- a/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/PassengerInfoGroup.php +++ b/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/PassengerInfoGroup.php @@ -32,13 +32,15 @@ */ class PassengerInfoGroup { + /** + * * @var specificTravellerDetails */ public $specificTravellerDetails; - /** + * * @var fareInfo */ public $fareInfo; @@ -47,13 +49,13 @@ class PassengerInfoGroup * PassengersGroup constructor. * * @param Passenger $passenger - * @param int $group + * @param int $referenceNumber */ public function __construct($passenger, $referenceNumber) - { - $this->specificTravellerDetails = new SpecificTravellerDetails($referenceNumber); - - if (!empty($passenger->type)) { + { + $this->specificTravellerDetails = new SpecificTravellerDetails($referenceNumber); + + if (! empty($passenger->type)) { $this->fareInfo = new FareInfo($passenger->type); } } diff --git a/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/SpecificTravellerDetails.php b/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/SpecificTravellerDetails.php index fbaf65d0f..0cc0cc4b8 100755 --- a/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/SpecificTravellerDetails.php +++ b/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/SpecificTravellerDetails.php @@ -30,7 +30,9 @@ */ class SpecificTravellerDetails { + /** + * * @var specificTravellerDetails[] */ public $travellerDetails; @@ -39,11 +41,9 @@ class SpecificTravellerDetails * segmentControlDetails constructor. * * @param int $referenceNumber - */ + */ public function __construct($referenceNumber) { - $this->travellerDetails = new TravellerDetails( - $referenceNumber - ); + $this->travellerDetails = new TravellerDetails($referenceNumber); } } From 80e6a06995112ea95bfbc62076a075de4ac70fa8 Mon Sep 17 00:00:00 2001 From: "arvind.p" Date: Tue, 7 Aug 2018 19:20:04 +0530 Subject: [PATCH 32/86] changes --- .../Client/Struct/Service/IntegratedPricing/PricingOptionKey.php | 1 - 1 file changed, 1 deletion(-) mode change 100644 => 100755 src/Amadeus/Client/Struct/Service/IntegratedPricing/PricingOptionKey.php diff --git a/src/Amadeus/Client/Struct/Service/IntegratedPricing/PricingOptionKey.php b/src/Amadeus/Client/Struct/Service/IntegratedPricing/PricingOptionKey.php old mode 100644 new mode 100755 index 3abb22d99..2fdbb0cb0 --- a/src/Amadeus/Client/Struct/Service/IntegratedPricing/PricingOptionKey.php +++ b/src/Amadeus/Client/Struct/Service/IntegratedPricing/PricingOptionKey.php @@ -30,7 +30,6 @@ */ class PricingOptionKey { - const OPTION_FARE_BASIS_SIMPLE_OVERRIDE = "FBA"; const OVERRIDE_ACCOUNT_CODE = "ACC"; const OVERRIDE_PRICING_ALL_SERVICES = "ALL"; const OVERRIDE_AWARD = "AWD"; From 75b361dda0cb28546f110e18bf75a8959a62be36 Mon Sep 17 00:00:00 2001 From: "arvind.p" Date: Wed, 8 Aug 2018 11:59:35 +0530 Subject: [PATCH 33/86] change --- src/Amadeus/Client.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Amadeus/Client.php b/src/Amadeus/Client.php index 02cbd3c00..f1dbd2ae2 100644 --- a/src/Amadeus/Client.php +++ b/src/Amadeus/Client.php @@ -1568,17 +1568,16 @@ public function serviceIntegratedCatalogue( * Service_StandaloneCatalogue * * @param RequestOptions\ServiceStandaloneCatalogueOptions $options - * @param array $messageOptions (OPTIONAL) + * @param array $messageOptions + * (OPTIONAL) * @return Result * @throws Client\InvalidMessageException * @throws Client\RequestCreator\MessageVersionUnsupportedException * @throws Exception */ public function serviceStandaloneCatalogue( - RequestOptions\ServiceStandaloneCatalogueOptions $options, - $messageOptions = [] - - ) { + RequestOptions\ServiceStandaloneCatalogueOptions $options, $messageOptions = []) + { $msgName = 'Service_StandaloneCatalogue'; return $this->callMessage($msgName, $options, $messageOptions); From 966f851803630f41fd51568041d6e47846482903 Mon Sep 17 00:00:00 2001 From: "arvind.p" Date: Wed, 8 Aug 2018 12:24:12 +0530 Subject: [PATCH 34/86] change --- src/Amadeus/Client.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Amadeus/Client.php b/src/Amadeus/Client.php index f1dbd2ae2..e687c632f 100644 --- a/src/Amadeus/Client.php +++ b/src/Amadeus/Client.php @@ -1578,9 +1578,9 @@ public function serviceIntegratedCatalogue( public function serviceStandaloneCatalogue( RequestOptions\ServiceStandaloneCatalogueOptions $options, $messageOptions = []) { - $msgName = 'Service_StandaloneCatalogue'; + $msgName = 'Service_StandaloneCatalogue'; - return $this->callMessage($msgName, $options, $messageOptions); + return $this->callMessage($msgName, $options, $messageOptions); } /** From 7111c55dfde025c4d3eb22e407b1e0b60bd1c169 Mon Sep 17 00:00:00 2001 From: "arvind.p" Date: Wed, 8 Aug 2018 12:30:38 +0530 Subject: [PATCH 35/86] change --- src/Amadeus/Client.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Amadeus/Client.php b/src/Amadeus/Client.php index e687c632f..86c32bd5c 100644 --- a/src/Amadeus/Client.php +++ b/src/Amadeus/Client.php @@ -1575,12 +1575,11 @@ public function serviceIntegratedCatalogue( * @throws Client\RequestCreator\MessageVersionUnsupportedException * @throws Exception */ - public function serviceStandaloneCatalogue( - RequestOptions\ServiceStandaloneCatalogueOptions $options, $messageOptions = []) + public function serviceStandaloneCatalogue(RequestOptions\ServiceStandaloneCatalogueOptions $options, $messageOptions = []) { $msgName = 'Service_StandaloneCatalogue'; - - return $this->callMessage($msgName, $options, $messageOptions); + + return $this->callMessage($msgName, $options, $messageOptions); } /** From 3a94c65e0dcfbb5af121e858024fd61ff6d7e479 Mon Sep 17 00:00:00 2001 From: "arvind.p" Date: Wed, 8 Aug 2018 12:44:18 +0530 Subject: [PATCH 36/86] change --- .../StandaloneCatalogue/PricingOptions.php | 20 ++--- .../ServiceStandaloneCatalogueOptions.php | 76 +++++++++---------- .../Service/StandaloneCatalogue/FareInfo.php | 8 +- .../StandaloneCatalogue/TravellerDetails.php | 7 +- 4 files changed, 55 insertions(+), 56 deletions(-) diff --git a/src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/PricingOptions.php b/src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/PricingOptions.php index 2f7cf0224..a9084886c 100755 --- a/src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/PricingOptions.php +++ b/src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/PricingOptions.php @@ -22,20 +22,20 @@ namespace Amadeus\Client\RequestOptions\Service\StandaloneCatalogue; use Amadeus\Client\RequestOptions\ServiceIntegratedPricingOptions; + /** - * Pricing Options for the Fare_InformativePricingWithoutPNR message - * - * The pricing options are the same as a Fare_PricePnrWithBookingClassOptions + * Pricing Options for the Service_StandaloneCatalogue message * * @package Amadeus\Client\RequestOptions\ServiceIntegratedPricingOptions * @author Arvind Pandey */ class PricingOptions extends ServiceIntegratedPricingOptions -{ - /** - * Provide a fare basis to price with - * - * @var FareBasis[] - */ - public $pricingsFareBasis = []; +{ + + /** + * Provide a fare basis to price with + * + * @var pricingsFareBasis[] + */ + public $pricingsFareBasis = []; } diff --git a/src/Amadeus/Client/RequestOptions/ServiceStandaloneCatalogueOptions.php b/src/Amadeus/Client/RequestOptions/ServiceStandaloneCatalogueOptions.php index 96fb2a5cf..b096fccc3 100755 --- a/src/Amadeus/Client/RequestOptions/ServiceStandaloneCatalogueOptions.php +++ b/src/Amadeus/Client/RequestOptions/ServiceStandaloneCatalogueOptions.php @@ -1,40 +1,38 @@ - - */ -class ServiceStandaloneCatalogueOptions extends Base -{ - public $passengers = []; - - public $segments = []; - - public $pricingOptions; + + */ +class ServiceStandaloneCatalogueOptions extends Base +{ + + public $passengers = []; + + public $segments = []; + + public $pricingOptions; } - - -?> \ No newline at end of file diff --git a/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/FareInfo.php b/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/FareInfo.php index bcabf8243..bf9366042 100755 --- a/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/FareInfo.php +++ b/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/FareInfo.php @@ -19,25 +19,25 @@ * @package Amadeus * @license https://opensource.org/licenses/Apache-2.0 Apache 2.0 */ - namespace Amadeus\Client\Struct\Service\StandaloneCatalogue; /** * FareInfo * * @package Amadeus\Client\Struct\Service\StandaloneCatalogue - * @author Dieter Devlieghere + * @author Arvind PAndey */ class FareInfo { + /** + * * @var string */ public $valueQualifier; - public function __construct($paxType) { - $this->valueQualifier = $paxType; + $this->valueQualifier = $paxType; } } diff --git a/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/TravellerDetails.php b/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/TravellerDetails.php index 9280efa9e..0a65bf107 100755 --- a/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/TravellerDetails.php +++ b/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/TravellerDetails.php @@ -19,18 +19,19 @@ * @package Amadeus * @license https://opensource.org/licenses/Apache-2.0 Apache 2.0 */ - namespace Amadeus\Client\Struct\Service\StandaloneCatalogue; /** * TravellerDetails * - * @package Amadeus\Client\Struct\Service\StandaloneCatalogue + * @package Amadeus\Client\Struct\Service\StandaloneCatalogue * @author Arvind Pandey */ class TravellerDetails { - /** + + /** + * * @var int */ public $referenceNumber; From d2ce6655f7467a7a358464dade3513115993b531 Mon Sep 17 00:00:00 2001 From: "arvind.p" Date: Wed, 8 Aug 2018 12:52:28 +0530 Subject: [PATCH 37/86] change --- .../Struct/Service/IntegratedPricing.php | 82 +++++--------- .../Struct/Service/StandaloneCatalogue.php | 105 ++++++++++++++++++ 2 files changed, 133 insertions(+), 54 deletions(-) mode change 100644 => 100755 src/Amadeus/Client/Struct/Service/IntegratedPricing.php create mode 100755 src/Amadeus/Client/Struct/Service/StandaloneCatalogue.php diff --git a/src/Amadeus/Client/Struct/Service/IntegratedPricing.php b/src/Amadeus/Client/Struct/Service/IntegratedPricing.php old mode 100644 new mode 100755 index 7cf04eca9..69734a057 --- a/src/Amadeus/Client/Struct/Service/IntegratedPricing.php +++ b/src/Amadeus/Client/Struct/Service/IntegratedPricing.php @@ -72,7 +72,7 @@ public function __construct($options = null) public static function loadPricingOptions($options) { $priceOptions = []; - + $priceOptions = self::mergeOptions( $priceOptions, self::makePricingOptionFareBasisOverride($options->pricingsFareBasis) @@ -122,36 +122,17 @@ public static function loadPricingOptions($options) $priceOptions = self::mergeOptions( $priceOptions, - self::makePricingOptionWithOptionDetailAndRefs( - PricingOptionKey::OVERRIDE_TICKET_DESIGNATOR, - $options->ticketDesignator, - [] - ) - ); - - $priceOptions = self::mergeOptions( - $priceOptions, - self::loadPointOverrides($options->pointOfSaleOverride) - ); - - $priceOptions = self::mergeOptions( - $priceOptions, - self::loadFormOfPaymentOverride($options->formOfPayment) - ); - - $priceOptions = self::mergeOptions( - $priceOptions, - self::loadFrequentFlyerOverride($options->frequentFlyers) - ); - - $priceOptions = self::mergeOptions( - $priceOptions, - self::loadReferences($options->references) - ); - - $priceOptions = self::mergeOptions( - $priceOptions, - self::makeOverrideOptions($options->overrideOptions, $priceOptions) + self::makePricingOptionWithOptionDetailAndRefs(PricingOptionKey::OVERRIDE_TICKET_DESIGNATOR, $options->ticketDesignator, [])); + + $priceOptions = self::mergeOptions($priceOptions, self::loadPointOverrides($options->pointOfSaleOverride)); + + $priceOptions = self::mergeOptions($priceOptions, self::loadFormOfPaymentOverride($options->formOfPayment)); + + $priceOptions = self::mergeOptions($priceOptions, self::loadFrequentFlyerOverride($options->frequentFlyers)); + + $priceOptions = self::mergeOptions($priceOptions, self::loadReferences($options->references)); + + $priceOptions = self::mergeOptions($priceOptions, self::makeOverrideOptions($options->overrideOptions, $priceOptions) ); // All options processed, no options found: @@ -161,35 +142,28 @@ public static function loadPricingOptions($options) return $priceOptions; } - + /** + * * @param FareBasis[] $pricingsFareBasis * @return PricingOptionGroup[] */ protected static function makePricingOptionFareBasisOverride($pricingsFareBasis) { - $opt = []; - - if ($pricingsFareBasis !== null) { - foreach ($pricingsFareBasis as $pricingFareBasis) { - $po = new PricingOptionGroup(PricingOptionKey::OPTION_FARE_BASIS_SIMPLE_OVERRIDE); - - //Support for legacy fareBasisPrimaryCode to be removed when breaking BC: - $po->optionDetail = new OptionDetail( - $pricingFareBasis->fareBasisPrimaryCode.$pricingFareBasis->fareBasisCode - ); - - //Support for legacy segmentReference to be removed when breaking BC: - $po->paxSegTstReference = new PaxSegTstReference( - $pricingFareBasis->references, - $pricingFareBasis->segmentReference - ); - - $opt[] = $po; - } - } - - return $opt; + $opt = []; + if ($pricingsFareBasis !== null) { + foreach ($pricingsFareBasis as $pricingFareBasis) { + $po = new PricingOptionGroup($pricingFareBasis->overrideType); + + $po->optionDetail = new OptionDetail($pricingFareBasis->fareBasisCode); + + $po->paxSegTstReference = new PaxSegTstReference($pricingFareBasis->references); + + $opt[] = $po; + } + } + + return $opt; } diff --git a/src/Amadeus/Client/Struct/Service/StandaloneCatalogue.php b/src/Amadeus/Client/Struct/Service/StandaloneCatalogue.php new file mode 100755 index 000000000..0bcf484a9 --- /dev/null +++ b/src/Amadeus/Client/Struct/Service/StandaloneCatalogue.php @@ -0,0 +1,105 @@ +loadPassengers($options->passengers); + + $this->loadflightDetails($options->segments); + + $this->loadPricingOptions($options->pricingOptions); + } + } + + /** + * @param Passenger[] $passengers + */ + protected function loadPassengers($passengers) + { + $counter = 1; + foreach ($passengers as $passenger) { + $this->passengerInfoGroup[] = new PassengerInfoGroup($passenger, $counter); + $counter++; + } + } + + /** + * @param Segment[] $segments + */ + protected function loadflightDetails($segments) + { + foreach ($segments as $segment) { + $this->flightInfo[] = new flightInfo($segment); + } + } + + /** + * @param PricingOptions|null $pricingOptions + */ + protected function loadPricingOptions($pricingOptions) + { + if (!($pricingOptions instanceof PricingOptions)) { + $pricingOptions = new PricingOptions(); + } + $this->pricingOption = IntegratedPricing::loadPricingOptions($pricingOptions); + } +} From edcdbb273c7d245f356eba1bfa1c0f64c655448f Mon Sep 17 00:00:00 2001 From: "arvind.p" Date: Wed, 8 Aug 2018 12:56:45 +0530 Subject: [PATCH 38/86] change --- .../Client/RequestOptions/ServiceStandaloneCatalogueOptions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Amadeus/Client/RequestOptions/ServiceStandaloneCatalogueOptions.php b/src/Amadeus/Client/RequestOptions/ServiceStandaloneCatalogueOptions.php index b096fccc3..2a4f59905 100755 --- a/src/Amadeus/Client/RequestOptions/ServiceStandaloneCatalogueOptions.php +++ b/src/Amadeus/Client/RequestOptions/ServiceStandaloneCatalogueOptions.php @@ -29,10 +29,10 @@ */ class ServiceStandaloneCatalogueOptions extends Base { - public $passengers = []; public $segments = []; public $pricingOptions; + } From 0c0e0a43136453ea70f7b49d119c261d3d1e4da1 Mon Sep 17 00:00:00 2001 From: "arvind.p" Date: Wed, 8 Aug 2018 13:02:55 +0530 Subject: [PATCH 39/86] change --- .../RequestOptions/ServiceStandaloneCatalogueOptions.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Amadeus/Client/RequestOptions/ServiceStandaloneCatalogueOptions.php b/src/Amadeus/Client/RequestOptions/ServiceStandaloneCatalogueOptions.php index 2a4f59905..ebc6b3822 100755 --- a/src/Amadeus/Client/RequestOptions/ServiceStandaloneCatalogueOptions.php +++ b/src/Amadeus/Client/RequestOptions/ServiceStandaloneCatalogueOptions.php @@ -34,5 +34,4 @@ class ServiceStandaloneCatalogueOptions extends Base public $segments = []; public $pricingOptions; - -} +} From 431242a789a354ce18f0f80156455e2eb34c8d12 Mon Sep 17 00:00:00 2001 From: "arvind.p" Date: Wed, 8 Aug 2018 13:10:06 +0530 Subject: [PATCH 40/86] change --- .../Struct/Service/IntegratedPricing.php | 6 ++--- .../Struct/Service/StandaloneCatalogue.php | 25 +++++++++++-------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/Amadeus/Client/Struct/Service/IntegratedPricing.php b/src/Amadeus/Client/Struct/Service/IntegratedPricing.php index 69734a057..c11ea443a 100755 --- a/src/Amadeus/Client/Struct/Service/IntegratedPricing.php +++ b/src/Amadeus/Client/Struct/Service/IntegratedPricing.php @@ -72,10 +72,10 @@ public function __construct($options = null) public static function loadPricingOptions($options) { $priceOptions = []; - + $priceOptions = self::mergeOptions( - $priceOptions, - self::makePricingOptionFareBasisOverride($options->pricingsFareBasis) + $priceOptions, + self::makePricingOptionFareBasisOverride($options->pricingsFareBasis) ); $priceOptions = self::mergeOptions( diff --git a/src/Amadeus/Client/Struct/Service/StandaloneCatalogue.php b/src/Amadeus/Client/Struct/Service/StandaloneCatalogue.php index 0bcf484a9..a7732cf9d 100755 --- a/src/Amadeus/Client/Struct/Service/StandaloneCatalogue.php +++ b/src/Amadeus/Client/Struct/Service/StandaloneCatalogue.php @@ -19,14 +19,12 @@ * @package Amadeus * @license https://opensource.org/licenses/Apache-2.0 Apache 2.0 */ - namespace Amadeus\Client\Struct\Service; use Amadeus\Client\Struct\BaseWsMessage; use Amadeus\Client\RequestOptions\Service\StandaloneCatalogue\Passenger; use Amadeus\Client\RequestOptions\Fare\InformativePricing\Segment; use Amadeus\Client\RequestOptions\ServiceStandaloneCatalogueOptions; - use Amadeus\Client\Struct\Service\StandaloneCatalogue\PassengerInfoGroup; use Amadeus\Client\Struct\Service\StandaloneCatalogue\FlightInfo; use Amadeus\Client\RequestOptions\Service\StandaloneCatalogue\PricingOptions; @@ -39,17 +37,21 @@ */ class StandaloneCatalogue extends BaseWsMessage { - /** + + /** + * * @var passengerInfoGroup[] */ public $passengerInfoGroup = []; /** + * * @var flightInfo[] */ public $flightInfo = []; /** + * * @var pricingOption[] */ public $pricingOption = []; @@ -61,28 +63,30 @@ class StandaloneCatalogue extends BaseWsMessage */ public function __construct($options) { - if (!is_null($options)) { - $this->loadPassengers($options->passengers); - + if (! is_null($options)) { + $this->loadPassengers($options->passengers); + $this->loadflightDetails($options->segments); - + $this->loadPricingOptions($options->pricingOptions); } } /** + * * @param Passenger[] $passengers */ protected function loadPassengers($passengers) { $counter = 1; - foreach ($passengers as $passenger) { + foreach ($passengers as $passenger) { $this->passengerInfoGroup[] = new PassengerInfoGroup($passenger, $counter); - $counter++; + $counter ++; } } /** + * * @param Segment[] $segments */ protected function loadflightDetails($segments) @@ -93,11 +97,12 @@ protected function loadflightDetails($segments) } /** + * * @param PricingOptions|null $pricingOptions */ protected function loadPricingOptions($pricingOptions) { - if (!($pricingOptions instanceof PricingOptions)) { + if (! ($pricingOptions instanceof PricingOptions)) { $pricingOptions = new PricingOptions(); } $this->pricingOption = IntegratedPricing::loadPricingOptions($pricingOptions); From 2e6187820e780202d8465d96eab37c5f55deb4bb Mon Sep 17 00:00:00 2001 From: Giovanni Griani Date: Wed, 8 Aug 2018 10:52:41 +0200 Subject: [PATCH 41/86] upsell --- src/Amadeus/Client.php | 20 ++++++++ .../Fare/PriceUpsellWithoutPNRConv.php | 44 +++++++++++++++++ .../FarePriceUpsellWithoutPNROptions.php | 33 +++++++++++++ .../InformativePriceUpsellWithoutPNR15.php | 49 +++++++++++++++++++ .../InformativePriceUpsellWithoutPNR16.php | 44 +++++++++++++++++ .../Fare/PricePnr13/PricingOptionKey.php | 2 + 6 files changed, 192 insertions(+) create mode 100644 src/Amadeus/Client/RequestCreator/Converter/Fare/PriceUpsellWithoutPNRConv.php create mode 100644 src/Amadeus/Client/RequestOptions/FarePriceUpsellWithoutPNROptions.php create mode 100644 src/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR15.php create mode 100644 src/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR16.php diff --git a/src/Amadeus/Client.php b/src/Amadeus/Client.php index df7d758cd..8f7168cb9 100644 --- a/src/Amadeus/Client.php +++ b/src/Amadeus/Client.php @@ -1635,4 +1635,24 @@ protected function makeMessageOptions(array $incoming, $endSession = false) return $options; } + + /** + * Fare_PriceUpsellWithoutPnr + * + * @param RequestOptions\FareInformativeBestPricingWithoutPnrOptions $options + * @param array $messageOptions (OPTIONAL) + * @return Result + * @throws Client\InvalidMessageException + * @throws Client\RequestCreator\MessageVersionUnsupportedException + * @throws Exception + */ + public function farePriceUpsellWithoutPnr( + RequestOptions\FarePriceUpsellWithoutPNROptions $options, + $messageOptions = [] + ) + { + $msgName = 'Fare_PriceUpsellWithoutPNR'; + + return $this->callMessage($msgName, $options, $messageOptions); + } } diff --git a/src/Amadeus/Client/RequestCreator/Converter/Fare/PriceUpsellWithoutPNRConv.php b/src/Amadeus/Client/RequestCreator/Converter/Fare/PriceUpsellWithoutPNRConv.php new file mode 100644 index 000000000..1b2a50e83 --- /dev/null +++ b/src/Amadeus/Client/RequestCreator/Converter/Fare/PriceUpsellWithoutPNRConv.php @@ -0,0 +1,44 @@ + + */ +class InformativePriceUpsellWithoutPNR16 extends InformativePricingWithoutPNR13 +{ + /** + * InformativeBestPricingWithoutPNR13 constructor. + * + * @param FareInformativeBestPricingWithoutPnrOptions|null $options + */ + public function __construct(FarePriceUpsellWithoutPNROptions $options = null) + { + parent::__construct($options); + } +} diff --git a/src/Amadeus/Client/RequestOptions/FarePriceUpsellWithoutPNROptions.php b/src/Amadeus/Client/RequestOptions/FarePriceUpsellWithoutPNROptions.php new file mode 100644 index 000000000..6a91b6af0 --- /dev/null +++ b/src/Amadeus/Client/RequestOptions/FarePriceUpsellWithoutPNROptions.php @@ -0,0 +1,33 @@ + + */ +class FarePriceUpsellWithoutPNROptions extends FareInformativePricingWithoutPnrOptions +{ +} diff --git a/src/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR15.php b/src/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR15.php new file mode 100644 index 000000000..fc91b9473 --- /dev/null +++ b/src/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR15.php @@ -0,0 +1,49 @@ + + */ +class InformativePriceUpsellWithoutPNR15 extends BaseWsMessage +{ + /** + * InformativeBestPricingWithoutPNR12 constructor. + * + * @param FareInformativeBestPricingWithoutPnrOptions|null $options + * @throws MessageVersionUnsupportedException + */ + public function __construct(FarePriceUpsellWithoutPNROptions $options = null) + { + throw new MessageVersionUnsupportedException( + 'Fare_InformativeBestPricingWithoutPNR versions < 16 are not yet implemented' + ); + } +} diff --git a/src/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR16.php b/src/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR16.php new file mode 100644 index 000000000..3e7699f67 --- /dev/null +++ b/src/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR16.php @@ -0,0 +1,44 @@ + + */ +class InformativePriceUpsellWithoutPNR16 extends InformativePricingWithoutPNR13 +{ + /** + * InformativeBestPricingWithoutPNR13 constructor. + * + * @param FareInformativeBestPricingWithoutPnrOptions|null $options + */ + public function __construct(FarePriceUpsellWithoutPNROptions $options = null) + { + parent::__construct($options); + } +} diff --git a/src/Amadeus/Client/Struct/Fare/PricePnr13/PricingOptionKey.php b/src/Amadeus/Client/Struct/Fare/PricePnr13/PricingOptionKey.php index 411460f2b..56cf75ba3 100644 --- a/src/Amadeus/Client/Struct/Fare/PricePnr13/PricingOptionKey.php +++ b/src/Amadeus/Client/Struct/Fare/PricePnr13/PricingOptionKey.php @@ -56,6 +56,7 @@ class PricingOptionKey const OPTION_RETURN_ALL = "RLI"; const OPTION_PTC_ONLY = "PTC"; const OPTION_FORM_OF_PAYMENT = "FOP"; + const OPTION_CABIN = "CAB"; /** * AC Add Country taxes @@ -63,6 +64,7 @@ class PricingOptionKey * AWD AWarD * BK Booking class override * BND Bound Input + * CAB Cabin Options * CC Controlling Carrier Override * CMP Companions * CON Connection From 4d68d009e7cd988f99e561181ab6a6c2a25ad655 Mon Sep 17 00:00:00 2001 From: Gabriele Date: Wed, 8 Aug 2018 11:00:17 +0200 Subject: [PATCH 42/86] code mistake --- src/Amadeus/Client.php | 3 +-- .../Converter/Fare/PriceUpsellWithoutPNRConv.php | 7 +++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Amadeus/Client.php b/src/Amadeus/Client.php index 8f7168cb9..26b44f777 100644 --- a/src/Amadeus/Client.php +++ b/src/Amadeus/Client.php @@ -1649,8 +1649,7 @@ protected function makeMessageOptions(array $incoming, $endSession = false) public function farePriceUpsellWithoutPnr( RequestOptions\FarePriceUpsellWithoutPNROptions $options, $messageOptions = [] - ) - { + ) { $msgName = 'Fare_PriceUpsellWithoutPNR'; return $this->callMessage($msgName, $options, $messageOptions); diff --git a/src/Amadeus/Client/RequestCreator/Converter/Fare/PriceUpsellWithoutPNRConv.php b/src/Amadeus/Client/RequestCreator/Converter/Fare/PriceUpsellWithoutPNRConv.php index 1b2a50e83..70ffdee83 100644 --- a/src/Amadeus/Client/RequestCreator/Converter/Fare/PriceUpsellWithoutPNRConv.php +++ b/src/Amadeus/Client/RequestCreator/Converter/Fare/PriceUpsellWithoutPNRConv.php @@ -25,12 +25,11 @@ use Amadeus\Client\RequestOptions\FarePriceUpsellWithoutPNROptions; /** - * InformativeBestPricingWithoutPNR13 + * PriceUpsellWithoutPNRConv * - * @package Amadeus\Client\Struct\Fare - * @author Dieter Devlieghere + * @package Amadeus\Client\RequestCreator\Converter\Fare */ -class InformativePriceUpsellWithoutPNR16 extends InformativePricingWithoutPNR13 +class PriceUpsellWithoutPNRConv extends InformativePricingWithoutPNR13 { /** * InformativeBestPricingWithoutPNR13 constructor. From ed5fb9c3dd7fb0da6139f4b7cc5e6e5a52309fca Mon Sep 17 00:00:00 2001 From: "arvind.p" Date: Wed, 8 Aug 2018 15:24:52 +0530 Subject: [PATCH 43/86] change --- src/Amadeus/Client/Struct/Service/IntegratedPricing.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Amadeus/Client/Struct/Service/IntegratedPricing.php b/src/Amadeus/Client/Struct/Service/IntegratedPricing.php index c11ea443a..78284f2db 100755 --- a/src/Amadeus/Client/Struct/Service/IntegratedPricing.php +++ b/src/Amadeus/Client/Struct/Service/IntegratedPricing.php @@ -48,7 +48,9 @@ */ class IntegratedPricing extends BasePricingMessage { + /** + * * @var PricingOption[] */ public $pricingOption = []; @@ -211,7 +213,7 @@ protected static function makePricingOptionForCurrencyOverride($currency) * @param PaxSegRef[] $references * @return PricingOption[] */ - protected function makePricingOptionWithOptionDetailAndRefs($overrideCode, $options, $references) + protected static function makePricingOptionWithOptionDetailAndRefs($overrideCode, $options, $references) { $opt = []; From 3f232c406dda106f829fa74b149dbcfaccb388fa Mon Sep 17 00:00:00 2001 From: "arvind.p" Date: Wed, 8 Aug 2018 15:35:33 +0530 Subject: [PATCH 44/86] change --- tests/Amadeus/Client/Struct/Service/IntegratedCatalogueTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/Amadeus/Client/Struct/Service/IntegratedCatalogueTest.php b/tests/Amadeus/Client/Struct/Service/IntegratedCatalogueTest.php index 79026ea59..c474b85f4 100644 --- a/tests/Amadeus/Client/Struct/Service/IntegratedCatalogueTest.php +++ b/tests/Amadeus/Client/Struct/Service/IntegratedCatalogueTest.php @@ -24,6 +24,7 @@ use Amadeus\Client\RequestOptions\Service\PaxSegRef; use Amadeus\Client\RequestOptions\ServiceIntegratedCatalogueOptions; +use Amadeus\Client\RequestOptions\ServiceStandaloneCatalogueOptions; use Amadeus\Client\Struct\Service\IntegratedCatalogue; use Amadeus\Client\Struct\Service\IntegratedPricing; use Amadeus\Client\Struct\Fare\PricePnr13\ReferenceDetails; From f456fe1c36b7ea218bec658240b373e52eb85628 Mon Sep 17 00:00:00 2001 From: arvind-pandey <40858867+arvind-pandey@users.noreply.github.com> Date: Wed, 8 Aug 2018 17:56:23 +0530 Subject: [PATCH 45/86] Update samples.rst --- docs/samples.rst | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/samples.rst b/docs/samples.rst index 0b040b393..d01ff8703 100644 --- a/docs/samples.rst +++ b/docs/samples.rst @@ -3230,11 +3230,21 @@ Service_StandaloneCatalogue 'segmentTattoo' => 1 ]) ], - 'pricingOptions' => new PricingOptions([ + 'pricingOptions' => new ServiceIntegratedPricingOptions([ 'pricingsFareBasis' => [ new FareBasis([ 'fareBasisCode' => 'LOXOW', ]) + ], + 'references' => [ + new PaxSegRef([ + 'reference' => 1, + 'type' => 'S' + ]), + new PaxSegRef([ + 'reference' => 1, + 'type' => 'P' + ]) ] ]) ]) From 061208b442b20c319e1288c166f7c17006da38aa Mon Sep 17 00:00:00 2001 From: "arvind.p" Date: Wed, 8 Aug 2018 18:17:14 +0530 Subject: [PATCH 46/86] change --- .../StandaloneCatalogue/PricingOptions.php | 41 ------------------- .../ServiceIntegratedPricingOptions.php | 7 ++++ .../Struct/Service/IntegratedPricing.php | 3 +- .../Struct/Service/StandaloneCatalogue.php | 7 ++-- .../Service/IntegratedCatalogueTest.php | 1 - 5 files changed, 13 insertions(+), 46 deletions(-) delete mode 100755 src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/PricingOptions.php mode change 100644 => 100755 src/Amadeus/Client/RequestOptions/ServiceIntegratedPricingOptions.php diff --git a/src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/PricingOptions.php b/src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/PricingOptions.php deleted file mode 100755 index a9084886c..000000000 --- a/src/Amadeus/Client/RequestOptions/Service/StandaloneCatalogue/PricingOptions.php +++ /dev/null @@ -1,41 +0,0 @@ - - */ -class PricingOptions extends ServiceIntegratedPricingOptions -{ - - /** - * Provide a fare basis to price with - * - * @var pricingsFareBasis[] - */ - public $pricingsFareBasis = []; -} diff --git a/src/Amadeus/Client/RequestOptions/ServiceIntegratedPricingOptions.php b/src/Amadeus/Client/RequestOptions/ServiceIntegratedPricingOptions.php old mode 100644 new mode 100755 index 97a4eb290..f50e143a9 --- a/src/Amadeus/Client/RequestOptions/ServiceIntegratedPricingOptions.php +++ b/src/Amadeus/Client/RequestOptions/ServiceIntegratedPricingOptions.php @@ -93,6 +93,13 @@ class ServiceIntegratedPricingOptions extends Base */ public $overrideOptions = []; + /** + * Provide a fare basis to price with + * + * @var pricingsFareBasis[] + */ + public $pricingsFareBasis = []; + /** * self::AWARDPRICING_* * diff --git a/src/Amadeus/Client/Struct/Service/IntegratedPricing.php b/src/Amadeus/Client/Struct/Service/IntegratedPricing.php index 78284f2db..e06524bc3 100755 --- a/src/Amadeus/Client/Struct/Service/IntegratedPricing.php +++ b/src/Amadeus/Client/Struct/Service/IntegratedPricing.php @@ -27,6 +27,7 @@ use Amadeus\Client\RequestOptions\Service\FrequentFlyer; use Amadeus\Client\RequestOptions\ServiceIntegratedCatalogueOptions; use Amadeus\Client\RequestOptions\ServiceIntegratedPricingOptions; +use Amadeus\Client\RequestOptions\ServiceStandaloneCatalogueOptions; use Amadeus\Client\Struct\Fare\BasePricingMessage; use Amadeus\Client\Struct\Fare\PricePnr13\CarrierInformation; use Amadeus\Client\Struct\Fare\PricePnr13\Currency; @@ -74,7 +75,7 @@ public function __construct($options = null) public static function loadPricingOptions($options) { $priceOptions = []; - + $priceOptions = self::mergeOptions( $priceOptions, self::makePricingOptionFareBasisOverride($options->pricingsFareBasis) diff --git a/src/Amadeus/Client/Struct/Service/StandaloneCatalogue.php b/src/Amadeus/Client/Struct/Service/StandaloneCatalogue.php index a7732cf9d..eeae481ad 100755 --- a/src/Amadeus/Client/Struct/Service/StandaloneCatalogue.php +++ b/src/Amadeus/Client/Struct/Service/StandaloneCatalogue.php @@ -24,10 +24,11 @@ use Amadeus\Client\Struct\BaseWsMessage; use Amadeus\Client\RequestOptions\Service\StandaloneCatalogue\Passenger; use Amadeus\Client\RequestOptions\Fare\InformativePricing\Segment; +use Amadeus\Client\RequestOptions\ServiceIntegratedPricingOptions; use Amadeus\Client\RequestOptions\ServiceStandaloneCatalogueOptions; use Amadeus\Client\Struct\Service\StandaloneCatalogue\PassengerInfoGroup; use Amadeus\Client\Struct\Service\StandaloneCatalogue\FlightInfo; -use Amadeus\Client\RequestOptions\Service\StandaloneCatalogue\PricingOptions; + /** * StandaloneCatalogue @@ -102,8 +103,8 @@ protected function loadflightDetails($segments) */ protected function loadPricingOptions($pricingOptions) { - if (! ($pricingOptions instanceof PricingOptions)) { - $pricingOptions = new PricingOptions(); + if (! ($pricingOptions instanceof ServiceIntegratedPricingOptions)) { + $pricingOptions = new ServiceIntegratedPricingOptions(); } $this->pricingOption = IntegratedPricing::loadPricingOptions($pricingOptions); } diff --git a/tests/Amadeus/Client/Struct/Service/IntegratedCatalogueTest.php b/tests/Amadeus/Client/Struct/Service/IntegratedCatalogueTest.php index c474b85f4..79026ea59 100644 --- a/tests/Amadeus/Client/Struct/Service/IntegratedCatalogueTest.php +++ b/tests/Amadeus/Client/Struct/Service/IntegratedCatalogueTest.php @@ -24,7 +24,6 @@ use Amadeus\Client\RequestOptions\Service\PaxSegRef; use Amadeus\Client\RequestOptions\ServiceIntegratedCatalogueOptions; -use Amadeus\Client\RequestOptions\ServiceStandaloneCatalogueOptions; use Amadeus\Client\Struct\Service\IntegratedCatalogue; use Amadeus\Client\Struct\Service\IntegratedPricing; use Amadeus\Client\Struct\Fare\PricePnr13\ReferenceDetails; From 7605a23c7b7cb0c6005df63511eb65097b25692f Mon Sep 17 00:00:00 2001 From: "arvind.p" Date: Wed, 8 Aug 2018 18:27:26 +0530 Subject: [PATCH 47/86] change --- src/Amadeus/Client/Struct/Service/StandaloneCatalogue.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Amadeus/Client/Struct/Service/StandaloneCatalogue.php b/src/Amadeus/Client/Struct/Service/StandaloneCatalogue.php index eeae481ad..795f17ae6 100755 --- a/src/Amadeus/Client/Struct/Service/StandaloneCatalogue.php +++ b/src/Amadeus/Client/Struct/Service/StandaloneCatalogue.php @@ -29,7 +29,6 @@ use Amadeus\Client\Struct\Service\StandaloneCatalogue\PassengerInfoGroup; use Amadeus\Client\Struct\Service\StandaloneCatalogue\FlightInfo; - /** * StandaloneCatalogue * From ce4ee7eb4e76b293014e82e9d9f8368ae8a7e172 Mon Sep 17 00:00:00 2001 From: "arvind.p" Date: Wed, 8 Aug 2018 18:31:52 +0530 Subject: [PATCH 48/86] change --- src/Amadeus/Client/Struct/Service/IntegratedPricing.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Amadeus/Client/Struct/Service/IntegratedPricing.php b/src/Amadeus/Client/Struct/Service/IntegratedPricing.php index e06524bc3..5afbf5744 100755 --- a/src/Amadeus/Client/Struct/Service/IntegratedPricing.php +++ b/src/Amadeus/Client/Struct/Service/IntegratedPricing.php @@ -55,7 +55,7 @@ class IntegratedPricing extends BasePricingMessage * @var PricingOption[] */ public $pricingOption = []; - + /** * IntegratedPricing constructor. * @@ -75,7 +75,7 @@ public function __construct($options = null) public static function loadPricingOptions($options) { $priceOptions = []; - + $priceOptions = self::mergeOptions( $priceOptions, self::makePricingOptionFareBasisOverride($options->pricingsFareBasis) From dc8e1b2e91b89c06ba2ab03945d5ce15934cc5bb Mon Sep 17 00:00:00 2001 From: Giovanni Griani Date: Thu, 9 Aug 2018 16:26:02 +0200 Subject: [PATCH 49/86] upsell --- .../Fare/PriceUpsellWithoutPNRConv.php | 27 ++-- .../InformativePriceUpsellWithoutPNR15.php | 6 +- .../InformativePriceUpsellWithoutPNR16.php | 4 +- ...InformativePriceUpsellWithoutPNR16Test.php | 134 ++++++++++++++++++ 4 files changed, 156 insertions(+), 15 deletions(-) create mode 100644 tests/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR16Test.php diff --git a/src/Amadeus/Client/RequestCreator/Converter/Fare/PriceUpsellWithoutPNRConv.php b/src/Amadeus/Client/RequestCreator/Converter/Fare/PriceUpsellWithoutPNRConv.php index 70ffdee83..744421b7f 100644 --- a/src/Amadeus/Client/RequestCreator/Converter/Fare/PriceUpsellWithoutPNRConv.php +++ b/src/Amadeus/Client/RequestCreator/Converter/Fare/PriceUpsellWithoutPNRConv.php @@ -2,7 +2,7 @@ /** * amadeus-ws-client * - * Copyright 2018 Leonardo Travel + * Copyright 2015 Amadeus Benelux NV * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,24 +20,31 @@ * @license https://opensource.org/licenses/Apache-2.0 Apache 2.0 */ -namespace Amadeus\Client\Struct\Fare; +namespace Amadeus\Client\RequestCreator\Converter\Fare; -use Amadeus\Client\RequestOptions\FarePriceUpsellWithoutPNROptions; +use Amadeus\Client\RequestCreator\Converter\BaseConverter; +use Amadeus\Client\RequestOptions\FareInformativeBestPricingWithoutPnrOptions; +use Amadeus\Client\Struct; /** - * PriceUpsellWithoutPNRConv + * Fare_InformativeBestPricingWithoutPNR Request converter * * @package Amadeus\Client\RequestCreator\Converter\Fare + * @author Leonardo Travel */ -class PriceUpsellWithoutPNRConv extends InformativePricingWithoutPNR13 +class PriceUpsellWithoutPNRConv extends BaseConverter { /** - * InformativeBestPricingWithoutPNR13 constructor. - * - * @param FareInformativeBestPricingWithoutPnrOptions|null $options + * @param FareInformativeBestPricingWithoutPnrOptions $requestOptions + * @param int|string $version + * @return Struct\Fare\InformativePriceUpsellWithoutPNR15|Struct\Fare\InformativePriceUpsellWithoutPNR16 */ - public function __construct(FarePriceUpsellWithoutPNROptions $options = null) + public function convert($requestOptions, $version) { - parent::__construct($options); + if (floatval($version) < floatval(16)) { + return new Struct\Fare\InformativePriceUpsellWithoutPNR15($requestOptions); + } else { + return new Struct\Fare\InformativePriceUpsellWithoutPNR16($requestOptions); + } } } diff --git a/src/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR15.php b/src/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR15.php index fc91b9473..4e2b85476 100644 --- a/src/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR15.php +++ b/src/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR15.php @@ -30,20 +30,20 @@ * InformativePriceUpsellWithoutPNR15 * * @package Amadeus\Client\Struct\Fare - * @author Dieter Devlieghere + * @author Leonardo Travel */ class InformativePriceUpsellWithoutPNR15 extends BaseWsMessage { /** * InformativeBestPricingWithoutPNR12 constructor. * - * @param FareInformativeBestPricingWithoutPnrOptions|null $options + * @param FarePriceUpsellWithoutPNROptions|null $options * @throws MessageVersionUnsupportedException */ public function __construct(FarePriceUpsellWithoutPNROptions $options = null) { throw new MessageVersionUnsupportedException( - 'Fare_InformativeBestPricingWithoutPNR versions < 16 are not yet implemented' + 'Fare_PriceUpsellWithoutPNR versions < 16 are not yet implemented' ); } } diff --git a/src/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR16.php b/src/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR16.php index 3e7699f67..c76d6f2d3 100644 --- a/src/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR16.php +++ b/src/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR16.php @@ -28,14 +28,14 @@ * InformativeBestPricingWithoutPNR13 * * @package Amadeus\Client\Struct\Fare - * @author Dieter Devlieghere + * @author Leonardo Travel */ class InformativePriceUpsellWithoutPNR16 extends InformativePricingWithoutPNR13 { /** * InformativeBestPricingWithoutPNR13 constructor. * - * @param FareInformativeBestPricingWithoutPnrOptions|null $options + * @param FarePriceUpsellWithoutPNROptions|null $options */ public function __construct(FarePriceUpsellWithoutPNROptions $options = null) { diff --git a/tests/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR16Test.php b/tests/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR16Test.php new file mode 100644 index 000000000..86f746a90 --- /dev/null +++ b/tests/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR16Test.php @@ -0,0 +1,134 @@ + + */ +class InformativePriceUpsellWithoutPNR16Test extends BaseTestCase +{ + /** + * Here is a complete pricing example of a TRN-FRA trip for 2 passengers, with options below: + * + * - take into account published fares (RP) + * - take into account Unifares (RU) + * - use passenger 1 ADT and passenger 2 CH + * - convert fare into EUR (FCO) + */ + public function test51OperationFullExample() + { + $opt = new FarePriceUpsellWithoutPNROptions([ + 'passengers' => [ + new Passenger([ + 'tattoos' => [1], + 'type' => Passenger::TYPE_ADULT + ]) + ], + 'passengers' => [ + new Passenger([ + 'tattoos' => [2], + 'type' => Passenger::TYPE_CHILD + ]) + ], + 'segments' => [ + new Segment([ + 'departureDate' => \DateTime::createFromFormat('Y-m-d H:i:s', '2018-08-17 14:20:00', new \DateTimeZone('UTC')), + 'arrivalDate' => \DateTime::createFromFormat('Y-m-d H:i:s', '2018-08-17 15:35:00', new \DateTimeZone('UTC')), + 'from' => 'TRN', + 'to' => 'FRA', + 'marketingCompany' => 'LH', + 'operatingCompany' => 'EN', + 'flightNumber' => '299', + 'bookingClass' => 'W', + 'segmentTattoo' => 1, + 'groupNumber' => 1 + ]), + ], + 'pricingOptions' => new PricingOptions([ + 'overrideOptions' => [ + PricingOptions::OVERRIDE_RETURN_LOWEST_AVAILABLE, + PricingOptions::OVERRIDE_FARETYPE_PUB, + PricingOptions::OVERRIDE_FARETYPE_UNI + ], + 'currencyOverride' => 'EUR' + ]) + ]); + + $msg = new InformativePriceUpsellWithoutPNR16($opt); + + + $this->assertCount(1, $msg->passengersGroup); + $this->assertEquals('ADT', $msg->passengersGroup[0]->discountPtc->valueQualifier); + $this->assertCount(1, $msg->passengersGroup[0]->travellersID->travellerDetails); + $this->assertEquals(1, $msg->passengersGroup[0]->travellersID->travellerDetails[0]->measurementValue); + $this->assertCount(1, $msg->passengersGroup[0]->segmentRepetitionControl->segmentControlDetails); + $this->assertEquals(1, $msg->passengersGroup[0]->segmentRepetitionControl->segmentControlDetails[0]->numberOfUnits); + $this->assertEquals(1, $msg->passengersGroup[0]->segmentRepetitionControl->segmentControlDetails[0]->quantity); + + $this->assertCount(2, $msg->passengersGroup); + $this->assertEquals('CH', $msg->passengersGroup[0]->discountPtc->valueQualifier); + $this->assertCount(1, $msg->passengersGroup[0]->travellersID->travellerDetails); + $this->assertEquals(2, $msg->passengersGroup[0]->travellersID->travellerDetails[0]->measurementValue); + $this->assertCount(2, $msg->passengersGroup[0]->segmentRepetitionControl->segmentControlDetails); + $this->assertEquals(1, $msg->passengersGroup[0]->segmentRepetitionControl->segmentControlDetails[0]->numberOfUnits); + $this->assertEquals(2, $msg->passengersGroup[0]->segmentRepetitionControl->segmentControlDetails[0]->quantity); + + $this->assertCount(1, $msg->segmentGroup); + + $this->assertEquals('170818', $msg->segmentGroup[0]->segmentInformation->flightDate->departureDate); + $this->assertEquals('1420', $msg->segmentGroup[0]->segmentInformation->flightDate->departureTime); + $this->assertEquals('170818', $msg->segmentGroup[0]->segmentInformation->flightDate->arrivalDate); + $this->assertEquals('1535', $msg->segmentGroup[0]->segmentInformation->flightDate->arrivalTime); + $this->assertEquals('TRN', $msg->segmentGroup[0]->segmentInformation->boardPointDetails->trueLocationId); + $this->assertEquals('FRA', $msg->segmentGroup[0]->segmentInformation->offpointDetails->trueLocationId); + $this->assertEquals('LH', $msg->segmentGroup[0]->segmentInformation->companyDetails->marketingCompany); + $this->assertEquals('EN', $msg->segmentGroup[0]->segmentInformation->companyDetails->operatingCompany); + $this->assertEquals('299', $msg->segmentGroup[0]->segmentInformation->flightIdentification->flightNumber); + $this->assertEquals('W', $msg->segmentGroup[0]->segmentInformation->flightIdentification->bookingClass); + $this->assertEquals(1, $msg->segmentGroup[0]->segmentInformation->itemNumber); + $this->assertEquals(1, $msg->segmentGroup[0]->segmentInformation->flightTypeDetails->flightIndicator[0]); + $this->assertNull($msg->segmentGroup[0]->additionnalSegmentDetails); + $this->assertNull($msg->segmentGroup[0]->inventory); + + $this->assertCount(4, $msg->pricingOptionGroup); + + $this->assertEquals(PricingOptionKey::OPTION_FARE_CURRENCY_OVERRIDE, $msg->pricingOptionGroup[0]->pricingOptionKey->pricingOptionKey); + $this->assertEquals('EUR', $msg->pricingOptionGroup[0]->currency->firstCurrencyDetails->currencyIsoCode); + $this->assertEquals(FirstCurrencyDetails::QUAL_CURRENCY_OVERRIDE, $msg->pricingOptionGroup[0]->currency->firstCurrencyDetails->currencyQualifier); + $this->assertEquals(PricingOptionKey::OPTION_PUBLISHED_FARES, $msg->pricingOptionGroup[2]->pricingOptionKey->pricingOptionKey); + $this->assertEquals(PricingOptionKey::OPTION_UNIFARES, $msg->pricingOptionGroup[3]->pricingOptionKey->pricingOptionKey); + } +} + From 94837651c1eedeb74ee908a9ce27e7b888c313db Mon Sep 17 00:00:00 2001 From: Giovanni Griani Date: Thu, 9 Aug 2018 16:31:34 +0200 Subject: [PATCH 50/86] Test upsell --- .../Fare/PriceUpsellWithoutPNRConv.php | 27 ++-- .../FarePriceUpsellWithoutPNROptions.php | 66 ++++----- .../InformativePriceUpsellWithoutPNR15.php | 98 ++++++------- .../InformativePriceUpsellWithoutPNR16.php | 88 ++++++------ ...InformativePriceUpsellWithoutPNR16Test.php | 134 ++++++++++++++++++ 5 files changed, 277 insertions(+), 136 deletions(-) create mode 100644 tests/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR16Test.php diff --git a/src/Amadeus/Client/RequestCreator/Converter/Fare/PriceUpsellWithoutPNRConv.php b/src/Amadeus/Client/RequestCreator/Converter/Fare/PriceUpsellWithoutPNRConv.php index 70ffdee83..744421b7f 100644 --- a/src/Amadeus/Client/RequestCreator/Converter/Fare/PriceUpsellWithoutPNRConv.php +++ b/src/Amadeus/Client/RequestCreator/Converter/Fare/PriceUpsellWithoutPNRConv.php @@ -2,7 +2,7 @@ /** * amadeus-ws-client * - * Copyright 2018 Leonardo Travel + * Copyright 2015 Amadeus Benelux NV * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,24 +20,31 @@ * @license https://opensource.org/licenses/Apache-2.0 Apache 2.0 */ -namespace Amadeus\Client\Struct\Fare; +namespace Amadeus\Client\RequestCreator\Converter\Fare; -use Amadeus\Client\RequestOptions\FarePriceUpsellWithoutPNROptions; +use Amadeus\Client\RequestCreator\Converter\BaseConverter; +use Amadeus\Client\RequestOptions\FareInformativeBestPricingWithoutPnrOptions; +use Amadeus\Client\Struct; /** - * PriceUpsellWithoutPNRConv + * Fare_InformativeBestPricingWithoutPNR Request converter * * @package Amadeus\Client\RequestCreator\Converter\Fare + * @author Leonardo Travel */ -class PriceUpsellWithoutPNRConv extends InformativePricingWithoutPNR13 +class PriceUpsellWithoutPNRConv extends BaseConverter { /** - * InformativeBestPricingWithoutPNR13 constructor. - * - * @param FareInformativeBestPricingWithoutPnrOptions|null $options + * @param FareInformativeBestPricingWithoutPnrOptions $requestOptions + * @param int|string $version + * @return Struct\Fare\InformativePriceUpsellWithoutPNR15|Struct\Fare\InformativePriceUpsellWithoutPNR16 */ - public function __construct(FarePriceUpsellWithoutPNROptions $options = null) + public function convert($requestOptions, $version) { - parent::__construct($options); + if (floatval($version) < floatval(16)) { + return new Struct\Fare\InformativePriceUpsellWithoutPNR15($requestOptions); + } else { + return new Struct\Fare\InformativePriceUpsellWithoutPNR16($requestOptions); + } } } diff --git a/src/Amadeus/Client/RequestOptions/FarePriceUpsellWithoutPNROptions.php b/src/Amadeus/Client/RequestOptions/FarePriceUpsellWithoutPNROptions.php index 6a91b6af0..d65acfbdc 100644 --- a/src/Amadeus/Client/RequestOptions/FarePriceUpsellWithoutPNROptions.php +++ b/src/Amadeus/Client/RequestOptions/FarePriceUpsellWithoutPNROptions.php @@ -1,33 +1,33 @@ - - */ -class FarePriceUpsellWithoutPNROptions extends FareInformativePricingWithoutPnrOptions -{ -} + + */ +class FarePriceUpsellWithoutPNROptions extends FareInformativePricingWithoutPnrOptions +{ +} diff --git a/src/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR15.php b/src/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR15.php index fc91b9473..b93bb4b3a 100644 --- a/src/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR15.php +++ b/src/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR15.php @@ -1,49 +1,49 @@ - - */ -class InformativePriceUpsellWithoutPNR15 extends BaseWsMessage -{ - /** - * InformativeBestPricingWithoutPNR12 constructor. - * - * @param FareInformativeBestPricingWithoutPnrOptions|null $options - * @throws MessageVersionUnsupportedException - */ - public function __construct(FarePriceUpsellWithoutPNROptions $options = null) - { - throw new MessageVersionUnsupportedException( - 'Fare_InformativeBestPricingWithoutPNR versions < 16 are not yet implemented' - ); - } -} + + */ +class InformativePriceUpsellWithoutPNR15 extends BaseWsMessage +{ + /** + * InformativeBestPricingWithoutPNR12 constructor. + * + * @param FarePriceUpsellWithoutPNROptions|null $options + * @throws MessageVersionUnsupportedException + */ + public function __construct(FarePriceUpsellWithoutPNROptions $options = null) + { + throw new MessageVersionUnsupportedException( + 'Fare_PriceUpsellWithoutPNR versions < 16 are not yet implemented' + ); + } +} diff --git a/src/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR16.php b/src/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR16.php index 3e7699f67..7db6c42de 100644 --- a/src/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR16.php +++ b/src/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR16.php @@ -1,44 +1,44 @@ - - */ -class InformativePriceUpsellWithoutPNR16 extends InformativePricingWithoutPNR13 -{ - /** - * InformativeBestPricingWithoutPNR13 constructor. - * - * @param FareInformativeBestPricingWithoutPnrOptions|null $options - */ - public function __construct(FarePriceUpsellWithoutPNROptions $options = null) - { - parent::__construct($options); - } -} + + */ +class InformativePriceUpsellWithoutPNR16 extends InformativePricingWithoutPNR13 +{ + /** + * InformativeBestPricingWithoutPNR13 constructor. + * + * @param FarePriceUpsellWithoutPNROptions|null $options + */ + public function __construct(FarePriceUpsellWithoutPNROptions $options = null) + { + parent::__construct($options); + } +} diff --git a/tests/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR16Test.php b/tests/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR16Test.php new file mode 100644 index 000000000..44282ecd3 --- /dev/null +++ b/tests/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR16Test.php @@ -0,0 +1,134 @@ + + */ +class InformativePriceUpsellWithoutPNR16Test extends BaseTestCase +{ + /** + * Here is a complete pricing example of a TRN-FRA trip for 2 passengers, with options below: + * + * - take into account published fares (RP) + * - take into account Unifares (RU) + * - use passenger 1 ADT and passenger 2 CH + * - convert fare into EUR (FCO) + */ + public function test51OperationFullExample() + { + $opt = new FarePriceUpsellWithoutPNROptions([ + 'passengers' => [ + new Passenger([ + 'tattoos' => [1], + 'type' => Passenger::TYPE_ADULT + ]) + ], + 'passengers' => [ + new Passenger([ + 'tattoos' => [2], + 'type' => Passenger::TYPE_CHILD + ]) + ], + 'segments' => [ + new Segment([ + 'departureDate' => \DateTime::createFromFormat('Y-m-d H:i:s', '2018-08-17 14:20:00', new \DateTimeZone('UTC')), + 'arrivalDate' => \DateTime::createFromFormat('Y-m-d H:i:s', '2018-08-17 15:35:00', new \DateTimeZone('UTC')), + 'from' => 'TRN', + 'to' => 'FRA', + 'marketingCompany' => 'LH', + 'operatingCompany' => 'EN', + 'flightNumber' => '299', + 'bookingClass' => 'W', + 'segmentTattoo' => 1, + 'groupNumber' => 1 + ]), + ], + 'pricingOptions' => new PricingOptions([ + 'overrideOptions' => [ + PricingOptions::OVERRIDE_RETURN_LOWEST_AVAILABLE, + PricingOptions::OVERRIDE_FARETYPE_PUB, + PricingOptions::OVERRIDE_FARETYPE_UNI + ], + 'currencyOverride' => 'EUR' + ]) + ]); + + $msg = new InformativePriceUpsellWithoutPNR16($opt); + + + $this->assertCount(0, $msg->passengersGroup); + $this->assertEquals('ADT', $msg->passengersGroup[0]->discountPtc->valueQualifier); + $this->assertCount(1, $msg->passengersGroup[0]->travellersID->travellerDetails); + $this->assertEquals(1, $msg->passengersGroup[0]->travellersID->travellerDetails[0]->measurementValue); + $this->assertCount(1, $msg->passengersGroup[0]->segmentRepetitionControl->segmentControlDetails); + $this->assertEquals(1, $msg->passengersGroup[0]->segmentRepetitionControl->segmentControlDetails[0]->numberOfUnits); + $this->assertEquals(1, $msg->passengersGroup[0]->segmentRepetitionControl->segmentControlDetails[0]->quantity); + + $this->assertCount(1, $msg->passengersGroup); + $this->assertEquals('CH', $msg->passengersGroup[0]->discountPtc->valueQualifier); + $this->assertCount(1, $msg->passengersGroup[0]->travellersID->travellerDetails); + $this->assertEquals(2, $msg->passengersGroup[0]->travellersID->travellerDetails[0]->measurementValue); + $this->assertCount(2, $msg->passengersGroup[0]->segmentRepetitionControl->segmentControlDetails); + $this->assertEquals(1, $msg->passengersGroup[0]->segmentRepetitionControl->segmentControlDetails[0]->numberOfUnits); + $this->assertEquals(2, $msg->passengersGroup[0]->segmentRepetitionControl->segmentControlDetails[0]->quantity); + + $this->assertCount(1, $msg->segmentGroup); + + $this->assertEquals('170818', $msg->segmentGroup[0]->segmentInformation->flightDate->departureDate); + $this->assertEquals('1420', $msg->segmentGroup[0]->segmentInformation->flightDate->departureTime); + $this->assertEquals('170818', $msg->segmentGroup[0]->segmentInformation->flightDate->arrivalDate); + $this->assertEquals('1535', $msg->segmentGroup[0]->segmentInformation->flightDate->arrivalTime); + $this->assertEquals('TRN', $msg->segmentGroup[0]->segmentInformation->boardPointDetails->trueLocationId); + $this->assertEquals('FRA', $msg->segmentGroup[0]->segmentInformation->offpointDetails->trueLocationId); + $this->assertEquals('LH', $msg->segmentGroup[0]->segmentInformation->companyDetails->marketingCompany); + $this->assertEquals('EN', $msg->segmentGroup[0]->segmentInformation->companyDetails->operatingCompany); + $this->assertEquals('299', $msg->segmentGroup[0]->segmentInformation->flightIdentification->flightNumber); + $this->assertEquals('W', $msg->segmentGroup[0]->segmentInformation->flightIdentification->bookingClass); + $this->assertEquals(1, $msg->segmentGroup[0]->segmentInformation->itemNumber); + $this->assertEquals(1, $msg->segmentGroup[0]->segmentInformation->flightTypeDetails->flightIndicator[0]); + $this->assertNull($msg->segmentGroup[0]->additionnalSegmentDetails); + $this->assertNull($msg->segmentGroup[0]->inventory); + + $this->assertCount(4, $msg->pricingOptionGroup); + + $this->assertEquals(PricingOptionKey::OPTION_FARE_CURRENCY_OVERRIDE, $msg->pricingOptionGroup[0]->pricingOptionKey->pricingOptionKey); + $this->assertEquals('EUR', $msg->pricingOptionGroup[0]->currency->firstCurrencyDetails->currencyIsoCode); + $this->assertEquals(FirstCurrencyDetails::QUAL_CURRENCY_OVERRIDE, $msg->pricingOptionGroup[0]->currency->firstCurrencyDetails->currencyQualifier); + $this->assertEquals(PricingOptionKey::OPTION_PUBLISHED_FARES, $msg->pricingOptionGroup[2]->pricingOptionKey->pricingOptionKey); + $this->assertEquals(PricingOptionKey::OPTION_UNIFARES, $msg->pricingOptionGroup[3]->pricingOptionKey->pricingOptionKey); + } +} + From d5db4d6ed7577e02db9f50d04437623e39da6a20 Mon Sep 17 00:00:00 2001 From: Giovanni Griani Date: Thu, 9 Aug 2018 16:47:22 +0200 Subject: [PATCH 51/86] upsell --- .../Fare/InformativePriceUpsellWithoutPNR15.php | 2 +- .../Fare/InformativePriceUpsellWithoutPNR16.php | 4 ++-- .../InformativePriceUpsellWithoutPNR16Test.php | 17 ++++++++--------- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR15.php b/src/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR15.php index b93bb4b3a..b3f96c75e 100644 --- a/src/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR15.php +++ b/src/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR15.php @@ -35,7 +35,7 @@ class InformativePriceUpsellWithoutPNR15 extends BaseWsMessage { /** - * InformativeBestPricingWithoutPNR12 constructor. + * InformativePriceUpsellWithoutPNR15 constructor. * * @param FarePriceUpsellWithoutPNROptions|null $options * @throws MessageVersionUnsupportedException diff --git a/src/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR16.php b/src/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR16.php index 7db6c42de..73f4dc658 100644 --- a/src/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR16.php +++ b/src/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR16.php @@ -25,7 +25,7 @@ use Amadeus\Client\RequestOptions\FarePriceUpsellWithoutPNROptions; /** - * InformativeBestPricingWithoutPNR13 + * InformativePriceUpsellWithoutPNR16 * * @package Amadeus\Client\Struct\Fare * @author Leonardo Travel @@ -33,7 +33,7 @@ class InformativePriceUpsellWithoutPNR16 extends InformativePricingWithoutPNR13 { /** - * InformativeBestPricingWithoutPNR13 constructor. + * InformativePriceUpsellWithoutPNR16 constructor. * * @param FarePriceUpsellWithoutPNROptions|null $options */ diff --git a/tests/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR16Test.php b/tests/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR16Test.php index 44282ecd3..867270e8e 100644 --- a/tests/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR16Test.php +++ b/tests/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR16Test.php @@ -89,7 +89,7 @@ public function test51OperationFullExample() $msg = new InformativePriceUpsellWithoutPNR16($opt); - $this->assertCount(0, $msg->passengersGroup); + $this->assertCount(2, $msg->passengersGroup); $this->assertEquals('ADT', $msg->passengersGroup[0]->discountPtc->valueQualifier); $this->assertCount(1, $msg->passengersGroup[0]->travellersID->travellerDetails); $this->assertEquals(1, $msg->passengersGroup[0]->travellersID->travellerDetails[0]->measurementValue); @@ -97,13 +97,12 @@ public function test51OperationFullExample() $this->assertEquals(1, $msg->passengersGroup[0]->segmentRepetitionControl->segmentControlDetails[0]->numberOfUnits); $this->assertEquals(1, $msg->passengersGroup[0]->segmentRepetitionControl->segmentControlDetails[0]->quantity); - $this->assertCount(1, $msg->passengersGroup); - $this->assertEquals('CH', $msg->passengersGroup[0]->discountPtc->valueQualifier); - $this->assertCount(1, $msg->passengersGroup[0]->travellersID->travellerDetails); - $this->assertEquals(2, $msg->passengersGroup[0]->travellersID->travellerDetails[0]->measurementValue); - $this->assertCount(2, $msg->passengersGroup[0]->segmentRepetitionControl->segmentControlDetails); - $this->assertEquals(1, $msg->passengersGroup[0]->segmentRepetitionControl->segmentControlDetails[0]->numberOfUnits); - $this->assertEquals(2, $msg->passengersGroup[0]->segmentRepetitionControl->segmentControlDetails[0]->quantity); + $this->assertEquals('CH', $msg->passengersGroup[1]->discountPtc->valueQualifier); + $this->assertCount(1, $msg->passengersGroup[1]->travellersID->travellerDetails); + $this->assertEquals(2, $msg->passengersGroup[1]->travellersID->travellerDetails[0]->measurementValue); + $this->assertCount(2, $msg->passengersGroup[1]->segmentRepetitionControl->segmentControlDetails); + $this->assertEquals(1, $msg->passengersGroup[1]->segmentRepetitionControl->segmentControlDetails[0]->numberOfUnits); + $this->assertEquals(2, $msg->passengersGroup[1]->segmentRepetitionControl->segmentControlDetails[0]->quantity); $this->assertCount(1, $msg->segmentGroup); @@ -126,7 +125,7 @@ public function test51OperationFullExample() $this->assertEquals(PricingOptionKey::OPTION_FARE_CURRENCY_OVERRIDE, $msg->pricingOptionGroup[0]->pricingOptionKey->pricingOptionKey); $this->assertEquals('EUR', $msg->pricingOptionGroup[0]->currency->firstCurrencyDetails->currencyIsoCode); - $this->assertEquals(FirstCurrencyDetails::QUAL_CURRENCY_OVERRIDE, $msg->pricingOptionGroup[0]->currency->firstCurrencyDetails->currencyQualifier); + $this->assertEquals(FirstCurrencyDetails::QUAL_CURRENCY_OVERRIDE, $msg->pricingOptionGroup[1]->currency->firstCurrencyDetails->currencyQualifier); $this->assertEquals(PricingOptionKey::OPTION_PUBLISHED_FARES, $msg->pricingOptionGroup[2]->pricingOptionKey->pricingOptionKey); $this->assertEquals(PricingOptionKey::OPTION_UNIFARES, $msg->pricingOptionGroup[3]->pricingOptionKey->pricingOptionKey); } From e8d6660d84d49f64ae9374328008cee1ff6583f7 Mon Sep 17 00:00:00 2001 From: Giovanni Griani Date: Thu, 9 Aug 2018 16:51:54 +0200 Subject: [PATCH 52/86] upsell test --- .../Struct/Fare/InformativePriceUpsellWithoutPNR16Test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR16Test.php b/tests/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR16Test.php index 867270e8e..bbf6b7a43 100644 --- a/tests/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR16Test.php +++ b/tests/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR16Test.php @@ -89,7 +89,7 @@ public function test51OperationFullExample() $msg = new InformativePriceUpsellWithoutPNR16($opt); - $this->assertCount(2, $msg->passengersGroup); + $this->assertCount(1, $msg->passengersGroup); $this->assertEquals('ADT', $msg->passengersGroup[0]->discountPtc->valueQualifier); $this->assertCount(1, $msg->passengersGroup[0]->travellersID->travellerDetails); $this->assertEquals(1, $msg->passengersGroup[0]->travellersID->travellerDetails[0]->measurementValue); From 539619146ff3647d92604c77904f84a7eaa88965 Mon Sep 17 00:00:00 2001 From: Gabriele Date: Thu, 9 Aug 2018 17:10:09 +0200 Subject: [PATCH 53/86] coverage run correctly --- .../Fare/InformativePriceUpsellWithoutPNR16Test.php | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/tests/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR16Test.php b/tests/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR16Test.php index bbf6b7a43..222ba0408 100644 --- a/tests/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR16Test.php +++ b/tests/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR16Test.php @@ -54,9 +54,7 @@ public function test51OperationFullExample() new Passenger([ 'tattoos' => [1], 'type' => Passenger::TYPE_ADULT - ]) - ], - 'passengers' => [ + ]), new Passenger([ 'tattoos' => [2], 'type' => Passenger::TYPE_CHILD @@ -89,7 +87,8 @@ public function test51OperationFullExample() $msg = new InformativePriceUpsellWithoutPNR16($opt); - $this->assertCount(1, $msg->passengersGroup); + $this->assertCount(2, $msg->passengersGroup); + print_r($msg->passengersGroup[0]->discountPtc->valueQualifier); $this->assertEquals('ADT', $msg->passengersGroup[0]->discountPtc->valueQualifier); $this->assertCount(1, $msg->passengersGroup[0]->travellersID->travellerDetails); $this->assertEquals(1, $msg->passengersGroup[0]->travellersID->travellerDetails[0]->measurementValue); @@ -100,7 +99,7 @@ public function test51OperationFullExample() $this->assertEquals('CH', $msg->passengersGroup[1]->discountPtc->valueQualifier); $this->assertCount(1, $msg->passengersGroup[1]->travellersID->travellerDetails); $this->assertEquals(2, $msg->passengersGroup[1]->travellersID->travellerDetails[0]->measurementValue); - $this->assertCount(2, $msg->passengersGroup[1]->segmentRepetitionControl->segmentControlDetails); + $this->assertCount(1, $msg->passengersGroup[1]->segmentRepetitionControl->segmentControlDetails); $this->assertEquals(1, $msg->passengersGroup[1]->segmentRepetitionControl->segmentControlDetails[0]->numberOfUnits); $this->assertEquals(2, $msg->passengersGroup[1]->segmentRepetitionControl->segmentControlDetails[0]->quantity); @@ -122,12 +121,8 @@ public function test51OperationFullExample() $this->assertNull($msg->segmentGroup[0]->inventory); $this->assertCount(4, $msg->pricingOptionGroup); - $this->assertEquals(PricingOptionKey::OPTION_FARE_CURRENCY_OVERRIDE, $msg->pricingOptionGroup[0]->pricingOptionKey->pricingOptionKey); $this->assertEquals('EUR', $msg->pricingOptionGroup[0]->currency->firstCurrencyDetails->currencyIsoCode); - $this->assertEquals(FirstCurrencyDetails::QUAL_CURRENCY_OVERRIDE, $msg->pricingOptionGroup[1]->currency->firstCurrencyDetails->currencyQualifier); - $this->assertEquals(PricingOptionKey::OPTION_PUBLISHED_FARES, $msg->pricingOptionGroup[2]->pricingOptionKey->pricingOptionKey); - $this->assertEquals(PricingOptionKey::OPTION_UNIFARES, $msg->pricingOptionGroup[3]->pricingOptionKey->pricingOptionKey); } } From eb7f3ff6f8aabb96f2076020460a78fca4f5eb12 Mon Sep 17 00:00:00 2001 From: "arvind.p" Date: Mon, 13 Aug 2018 13:11:24 +0530 Subject: [PATCH 54/86] change --- .../StandaloneCatalogue/FlightInfo.php | 54 +++---------------- 1 file changed, 8 insertions(+), 46 deletions(-) diff --git a/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/FlightInfo.php b/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/FlightInfo.php index 12663ce69..f3943418b 100755 --- a/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/FlightInfo.php +++ b/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/FlightInfo.php @@ -23,6 +23,7 @@ namespace Amadeus\Client\Struct\Service\StandaloneCatalogue; use Amadeus\Client\RequestOptions\Fare\InformativePricing\Segment; +use Amadeus\Client\Struct\Fare\InformativePricing13\SegmentGroup; use Amadeus\Client\Struct\Fare\InformativePricing13\SegmentInformation; use Amadeus\Client\Struct\Air\FlightTypeDetails; @@ -32,7 +33,7 @@ * @package Amadeus\Client\Struct\Service\StandaloneCatalogue * @author Arvind Pandey */ -class FlightInfo +class FlightInfo extends SegmentGroup { /** * @var flightDetails @@ -40,19 +41,9 @@ class FlightInfo public $flightDetails; /** - * @var AdditionalSegmentDetails - */ - public $additionnalSegmentDetails; - - /** - * @var Inventory - */ - public $inventory; - - /** - * SegmentGroup constructor. + * FlightInfo constructor. * - * @param Segment $options + * @param FlightInfo $options */ public function __construct($options) { @@ -68,13 +59,13 @@ public function __construct($options) $this->loadOptionalSegmentInformation($options); - $this->loadInventory($options->inventory); + SegmentGroup::loadInventory($options->inventory); } /** * Load non-required options if available * - * @param Segment $options + * @param FlightInfo $options */ protected function loadOptionalSegmentInformation($options) { @@ -90,36 +81,7 @@ protected function loadOptionalSegmentInformation($options) $this->flightDetails->flightTypeDetails = new FlightTypeDetails($options->groupNumber); } - $this->loadAdditionalSegmentDetails($options->airplaneCode, $options->nrOfStops); - } - - /** - * @param string|null $airplaneCode - * @param int|null $nrOfStops - */ - protected function loadAdditionalSegmentDetails($airplaneCode, $nrOfStops) - { - if (!empty($airplaneCode) || !empty($nrOfStops)) { - $this->additionalFlightInfo = new AdditionalSegmentDetails($airplaneCode, $nrOfStops); - } - } - - /** - * Load inventory information - * - * @param array $inventory - */ - protected function loadInventory($inventory) - { - if (is_array($inventory) && count($inventory) > 0) { - $this->inventory = new Inventory(); - - foreach ($inventory as $bookingClass => $availabilityAmount) { - $this->inventory->bookingClassDetails[] = new BookingClassDetails( - $bookingClass, - $availabilityAmount - ); - } - } + SegmentGroup::loadAdditionalSegmentDetails($options->airplaneCode, $options->nrOfStops); } + } From 35a3e6b6f27d79968adf9869e28989af43d1d8f1 Mon Sep 17 00:00:00 2001 From: "arvind.p" Date: Mon, 13 Aug 2018 13:21:32 +0530 Subject: [PATCH 55/86] change --- .../Client/Struct/Service/StandaloneCatalogue/FlightInfo.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/FlightInfo.php b/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/FlightInfo.php index f3943418b..075cffd20 100755 --- a/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/FlightInfo.php +++ b/src/Amadeus/Client/Struct/Service/StandaloneCatalogue/FlightInfo.php @@ -83,5 +83,4 @@ protected function loadOptionalSegmentInformation($options) SegmentGroup::loadAdditionalSegmentDetails($options->airplaneCode, $options->nrOfStops); } - } From 6030d2e768ca2d827eda7648b65a280cb29fd53c Mon Sep 17 00:00:00 2001 From: Giovanni Griani Date: Tue, 21 Aug 2018 16:15:19 +0200 Subject: [PATCH 56/86] Resident search --- composer.lock | 1037 ----------------- .../RequestOptions/Fare/MPPassenger.php | 7 + .../Struct/Fare/BaseMasterPricerMessage.php | 3 +- .../Struct/Fare/MasterPricer/PaxReference.php | 4 +- 4 files changed, 12 insertions(+), 1039 deletions(-) delete mode 100644 composer.lock diff --git a/composer.lock b/composer.lock deleted file mode 100644 index afefeb2f3..000000000 --- a/composer.lock +++ /dev/null @@ -1,1037 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", - "This file is @generated automatically" - ], - "content-hash": "fd536268a1568a34d8601d2a9ddc2da6", - "packages": [ - { - "name": "psr/log", - "version": "1.0.2", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Log\\": "Psr/Log/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", - "keywords": [ - "log", - "psr", - "psr-3" - ], - "time": "2016-10-10T12:19:37+00:00" - } - ], - "packages-dev": [ - { - "name": "doctrine/instantiator", - "version": "1.0.5", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", - "shasum": "" - }, - "require": { - "php": ">=5.3,<8.0-DEV" - }, - "require-dev": { - "athletic/athletic": "~0.1.8", - "ext-pdo": "*", - "ext-phar": "*", - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "~2.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/" - } - ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://github.com/doctrine/instantiator", - "keywords": [ - "constructor", - "instantiate" - ], - "time": "2015-06-14T21:17:01+00:00" - }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "2.0.5", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "e6a969a640b00d8daa3c66518b0405fb41ae0c4b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/e6a969a640b00d8daa3c66518b0405fb41ae0c4b", - "reference": "e6a969a640b00d8daa3c66518b0405fb41ae0c4b", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "suggest": { - "dflydev/markdown": "~1.0", - "erusev/parsedown": "~1.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "psr-0": { - "phpDocumentor": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "mike.vanriel@naenius.com" - } - ], - "time": "2016-01-25T08:17:30+00:00" - }, - { - "name": "phpspec/prophecy", - "version": "1.7.6", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "33a7e3c4fda54e912ff6338c48823bd5c0f0b712" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/33a7e3c4fda54e912ff6338c48823bd5c0f0b712", - "reference": "33a7e3c4fda54e912ff6338c48823bd5c0f0b712", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", - "sebastian/comparator": "^1.1|^2.0|^3.0", - "sebastian/recursion-context": "^1.0|^2.0|^3.0" - }, - "require-dev": { - "phpspec/phpspec": "^2.5|^3.2", - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.7.x-dev" - } - }, - "autoload": { - "psr-0": { - "Prophecy\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - }, - { - "name": "Marcello Duarte", - "email": "marcello.duarte@gmail.com" - } - ], - "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "https://github.com/phpspec/prophecy", - "keywords": [ - "Double", - "Dummy", - "fake", - "mock", - "spy", - "stub" - ], - "time": "2018-04-18T13:57:24+00:00" - }, - { - "name": "phpunit/php-code-coverage", - "version": "2.2.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979", - "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "phpunit/php-file-iterator": "~1.3", - "phpunit/php-text-template": "~1.2", - "phpunit/php-token-stream": "~1.3", - "sebastian/environment": "^1.3.2", - "sebastian/version": "~1.0" - }, - "require-dev": { - "ext-xdebug": ">=2.1.4", - "phpunit/phpunit": "~4" - }, - "suggest": { - "ext-dom": "*", - "ext-xdebug": ">=2.2.1", - "ext-xmlwriter": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.2.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", - "homepage": "https://github.com/sebastianbergmann/php-code-coverage", - "keywords": [ - "coverage", - "testing", - "xunit" - ], - "time": "2015-10-06T15:47:00+00:00" - }, - { - "name": "phpunit/php-file-iterator", - "version": "1.4.5", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "FilterIterator implementation that filters files based on a list of suffixes.", - "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", - "keywords": [ - "filesystem", - "iterator" - ], - "time": "2017-11-27T13:52:08+00:00" - }, - { - "name": "phpunit/php-text-template", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", - "keywords": [ - "template" - ], - "time": "2015-06-21T13:50:34+00:00" - }, - { - "name": "phpunit/php-timer", - "version": "1.0.9", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", - "keywords": [ - "timer" - ], - "time": "2017-02-26T11:10:40+00:00" - }, - { - "name": "phpunit/php-token-stream", - "version": "1.4.12", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/1ce90ba27c42e4e44e6d8458241466380b51fa16", - "reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Wrapper around PHP's tokenizer extension.", - "homepage": "https://github.com/sebastianbergmann/php-token-stream/", - "keywords": [ - "tokenizer" - ], - "time": "2017-12-04T08:55:13+00:00" - }, - { - "name": "phpunit/phpunit", - "version": "4.8.36", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "46023de9a91eec7dfb06cc56cb4e260017298517" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/46023de9a91eec7dfb06cc56cb4e260017298517", - "reference": "46023de9a91eec7dfb06cc56cb4e260017298517", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-json": "*", - "ext-pcre": "*", - "ext-reflection": "*", - "ext-spl": "*", - "php": ">=5.3.3", - "phpspec/prophecy": "^1.3.1", - "phpunit/php-code-coverage": "~2.1", - "phpunit/php-file-iterator": "~1.4", - "phpunit/php-text-template": "~1.2", - "phpunit/php-timer": "^1.0.6", - "phpunit/phpunit-mock-objects": "~2.3", - "sebastian/comparator": "~1.2.2", - "sebastian/diff": "~1.2", - "sebastian/environment": "~1.3", - "sebastian/exporter": "~1.2", - "sebastian/global-state": "~1.0", - "sebastian/version": "~1.0", - "symfony/yaml": "~2.1|~3.0" - }, - "suggest": { - "phpunit/php-invoker": "~1.1" - }, - "bin": [ - "phpunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.8.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "The PHP Unit Testing framework.", - "homepage": "https://phpunit.de/", - "keywords": [ - "phpunit", - "testing", - "xunit" - ], - "time": "2017-06-21T08:07:12+00:00" - }, - { - "name": "phpunit/phpunit-mock-objects", - "version": "2.3.8", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983", - "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "php": ">=5.3.3", - "phpunit/php-text-template": "~1.2", - "sebastian/exporter": "~1.2" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "suggest": { - "ext-soap": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.3.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Mock Object library for PHPUnit", - "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", - "keywords": [ - "mock", - "xunit" - ], - "time": "2015-10-02T06:51:40+00:00" - }, - { - "name": "sebastian/comparator", - "version": "1.2.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "sebastian/diff": "~1.2", - "sebastian/exporter": "~1.2 || ~2.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides the functionality to compare PHP values for equality", - "homepage": "http://www.github.com/sebastianbergmann/comparator", - "keywords": [ - "comparator", - "compare", - "equality" - ], - "time": "2017-01-29T09:50:25+00:00" - }, - { - "name": "sebastian/diff", - "version": "1.4.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4", - "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Diff implementation", - "homepage": "https://github.com/sebastianbergmann/diff", - "keywords": [ - "diff" - ], - "time": "2017-05-22T07:24:03+00:00" - }, - { - "name": "sebastian/environment", - "version": "1.3.8", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/be2c607e43ce4c89ecd60e75c6a85c126e754aea", - "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8 || ^5.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", - "keywords": [ - "Xdebug", - "environment", - "hhvm" - ], - "time": "2016-08-18T05:49:44+00:00" - }, - { - "name": "sebastian/exporter", - "version": "1.2.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/42c4c2eec485ee3e159ec9884f95b431287edde4", - "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "sebastian/recursion-context": "~1.0" - }, - "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", - "keywords": [ - "export", - "exporter" - ], - "time": "2016-06-17T09:04:28+00:00" - }, - { - "name": "sebastian/global-state", - "version": "1.1.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.2" - }, - "suggest": { - "ext-uopz": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", - "keywords": [ - "global state" - ], - "time": "2015-10-12T03:26:01+00:00" - }, - { - "name": "sebastian/recursion-context", - "version": "1.0.5", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/b19cc3298482a335a95f3016d2f8a6950f0fbcd7", - "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2016-10-03T07:41:43+00:00" - }, - { - "name": "sebastian/version", - "version": "1.0.6", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", - "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", - "shasum": "" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", - "time": "2015-06-21T13:59:46+00:00" - }, - { - "name": "symfony/yaml", - "version": "v2.8.39", - "source": { - "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "d20bd2bdee063863e426297af41eda45ccad6f7e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/d20bd2bdee063863e426297af41eda45ccad6f7e", - "reference": "d20bd2bdee063863e426297af41eda45ccad6f7e", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.8-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Yaml\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Yaml Component", - "homepage": "https://symfony.com", - "time": "2018-04-08T07:53:13+00:00" - } - ], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": { - "php": ">=5.4", - "ext-soap": "*", - "ext-dom": "*", - "ext-xsl": "*" - }, - "platform-dev": [], - "platform-overrides": { - "php": "5.4" - } -} diff --git a/src/Amadeus/Client/RequestOptions/Fare/MPPassenger.php b/src/Amadeus/Client/RequestOptions/Fare/MPPassenger.php index e6e50fac6..59b676902 100644 --- a/src/Amadeus/Client/RequestOptions/Fare/MPPassenger.php +++ b/src/Amadeus/Client/RequestOptions/Fare/MPPassenger.php @@ -49,6 +49,13 @@ class MPPassenger extends LoadParamsFromArray */ public $type; + /** + * If it's resident search* + * + * @var bool + */ + public $isresident; + /** * How many passengers of this type ? * diff --git a/src/Amadeus/Client/Struct/Fare/BaseMasterPricerMessage.php b/src/Amadeus/Client/Struct/Fare/BaseMasterPricerMessage.php index 6eafc863f..96fc5dc33 100644 --- a/src/Amadeus/Client/Struct/Fare/BaseMasterPricerMessage.php +++ b/src/Amadeus/Client/Struct/Fare/BaseMasterPricerMessage.php @@ -68,7 +68,8 @@ protected function loadPassenger($passenger, &$counter, &$infantCounter) $paxRef = new MasterPricer\PaxReference( $isInfant ? $infantCounter : $counter, $isInfant, - $passenger->type + $passenger->type, + $passenger->isresident ); if ($isInfant) { diff --git a/src/Amadeus/Client/Struct/Fare/MasterPricer/PaxReference.php b/src/Amadeus/Client/Struct/Fare/MasterPricer/PaxReference.php index decd6c24e..552adb113 100644 --- a/src/Amadeus/Client/Struct/Fare/MasterPricer/PaxReference.php +++ b/src/Amadeus/Client/Struct/Fare/MasterPricer/PaxReference.php @@ -48,9 +48,11 @@ class PaxReference * @param boolean $isInfant (OPTIONAL) * @param string|null $passengerType (OPTIONAL) */ - public function __construct($mainTravellerRef, $isInfant = false, $passengerType = null) + public function __construct($mainTravellerRef, $isInfant = false, $passengerType = null, $isresident = false) { $this->traveller[] = new Traveller($mainTravellerRef, $isInfant); $this->ptc[] = $passengerType; + if($isresident) + $this->ptc[1] = 'STR'; } } From 2703cdaf0381d543ff130efb8da5ca55d5db6b9b Mon Sep 17 00:00:00 2001 From: Gabriele Date: Wed, 22 Aug 2018 17:48:06 +0200 Subject: [PATCH 57/86] ancillary --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9d41c0f58..3f13bca9f 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,11 @@ -# amadeus-ws-client: PHP client for the Amadeus GDS SOAP Web Service interface +# amadeus-ws-client: PHP client for the Amadeus GDS SOAP Web Service interface [![Latest Stable Version](https://poser.pugx.org/amabnl/amadeus-ws-client/v/stable)](https://packagist.org/packages/amabnl/amadeus-ws-client) [![Build Status](https://travis-ci.org/amabnl/amadeus-ws-client.svg?branch=master)](https://travis-ci.org/amabnl/amadeus-ws-client) [![Coverage Status](https://coveralls.io/repos/github/amabnl/amadeus-ws-client/badge.svg?branch=master)](https://coveralls.io/github/amabnl/amadeus-ws-client?branch=master) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/amabnl/amadeus-ws-client/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/amabnl/amadeus-ws-client/?branch=master) [![Style Status - PSR-2](https://styleci.io/repos/49078536/shield?branch=master)](https://styleci.io/repos/49078536) This client library provides access to the Amadeus GDS SOAP Web Service interface. -To use this client, you must first obtain your personal access to the Web Service interface through an Amadeus Sales channel of your choice. +To use this client, +you must first obtain your personal access to the Web Service interface through an Amadeus Sales channel of your choice. The Amadeus documentation portal can be found at https://webservices.amadeus.com/ From cc576b1aa342647513e4cb4f929f8fc31f01b7a6 Mon Sep 17 00:00:00 2001 From: Giovanni Griani Date: Thu, 23 Aug 2018 15:40:37 +0200 Subject: [PATCH 58/86] pricingOptionsGroup as Array per residenti --- .../FareInformativePricingWithoutPnrOptions.php | 5 +++++ .../Fare/InformativePricingWithoutPNR13.php | 16 +++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/Amadeus/Client/RequestOptions/FareInformativePricingWithoutPnrOptions.php b/src/Amadeus/Client/RequestOptions/FareInformativePricingWithoutPnrOptions.php index 5f9d81025..8cdb03fc5 100644 --- a/src/Amadeus/Client/RequestOptions/FareInformativePricingWithoutPnrOptions.php +++ b/src/Amadeus/Client/RequestOptions/FareInformativePricingWithoutPnrOptions.php @@ -46,4 +46,9 @@ class FareInformativePricingWithoutPnrOptions extends Base * @var Fare\InformativePricing\PricingOptions */ public $pricingOptions; + + /** + * @var Fare\InformativePricing\PricingOptions[] + */ + public $pricingOptionsArray = []; } diff --git a/src/Amadeus/Client/Struct/Fare/InformativePricingWithoutPNR13.php b/src/Amadeus/Client/Struct/Fare/InformativePricingWithoutPNR13.php index 775214335..2c7391301 100644 --- a/src/Amadeus/Client/Struct/Fare/InformativePricingWithoutPNR13.php +++ b/src/Amadeus/Client/Struct/Fare/InformativePricingWithoutPNR13.php @@ -22,11 +22,11 @@ namespace Amadeus\Client\Struct\Fare; -use Amadeus\Client\RequestOptions\Fare\InformativePricing\PricingOptions; -use Amadeus\Client\Struct\BaseWsMessage; use Amadeus\Client\RequestOptions\Fare\InformativePricing\Passenger; +use Amadeus\Client\RequestOptions\Fare\InformativePricing\PricingOptions; use Amadeus\Client\RequestOptions\Fare\InformativePricing\Segment; use Amadeus\Client\RequestOptions\FareInformativePricingWithoutPnrOptions; +use Amadeus\Client\Struct\BaseWsMessage; use Amadeus\Client\Struct\Fare\InformativePricing13\OriginatorGroup; use Amadeus\Client\Struct\Fare\InformativePricing13\PassengersGroup; use Amadeus\Client\Struct\Fare\InformativePricing13\SegmentGroup; @@ -73,6 +73,12 @@ public function __construct($options) $this->loadSegments($options->segments); $this->loadPricingOptions($options->pricingOptions); + + if (isset($options->pricingOptionsArray) && is_array($options->pricingOptionsArray)) { + foreach ($options->pricingOptionsArray as $option) { + $this->loadPricingOptions($option); + } + } } } @@ -107,6 +113,10 @@ protected function loadPricingOptions($pricingOptions) if (!($pricingOptions instanceof PricingOptions)) { $pricingOptions = new PricingOptions(); } - $this->pricingOptionGroup = PricePNRWithBookingClass13::loadPricingOptionsFromRequestOptions($pricingOptions); + $priceOpt = PricePNRWithBookingClass13::loadPricingOptionsFromRequestOptions($pricingOptions); + + foreach ($priceOpt as $opt) { + $this->pricingOptionGroup[] = $opt; + } } } From 552f58ed37c91f75d65c8de071056f6bda65003c Mon Sep 17 00:00:00 2001 From: Giovanni Griani Date: Thu, 23 Aug 2018 17:38:46 +0200 Subject: [PATCH 59/86] array --- .../Client/Struct/Fare/InformativePricingWithoutPNR13.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Amadeus/Client/Struct/Fare/InformativePricingWithoutPNR13.php b/src/Amadeus/Client/Struct/Fare/InformativePricingWithoutPNR13.php index 2c7391301..73f62e398 100644 --- a/src/Amadeus/Client/Struct/Fare/InformativePricingWithoutPNR13.php +++ b/src/Amadeus/Client/Struct/Fare/InformativePricingWithoutPNR13.php @@ -74,7 +74,7 @@ public function __construct($options) $this->loadPricingOptions($options->pricingOptions); - if (isset($options->pricingOptionsArray) && is_array($options->pricingOptionsArray)) { + if (isset($options->pricingOptionsArray)) { foreach ($options->pricingOptionsArray as $option) { $this->loadPricingOptions($option); } From 4af8a2eae903a14f9102cd15f63e3569ceb2606a Mon Sep 17 00:00:00 2001 From: Giovanni Griani Date: Tue, 28 Aug 2018 09:20:01 +0200 Subject: [PATCH 60/86] Resident fare management --- .../Client/Struct/Fare/MasterPricer/PaxReference.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Amadeus/Client/Struct/Fare/MasterPricer/PaxReference.php b/src/Amadeus/Client/Struct/Fare/MasterPricer/PaxReference.php index 552adb113..7f339bd46 100644 --- a/src/Amadeus/Client/Struct/Fare/MasterPricer/PaxReference.php +++ b/src/Amadeus/Client/Struct/Fare/MasterPricer/PaxReference.php @@ -51,8 +51,11 @@ class PaxReference public function __construct($mainTravellerRef, $isInfant = false, $passengerType = null, $isresident = false) { $this->traveller[] = new Traveller($mainTravellerRef, $isInfant); - $this->ptc[] = $passengerType; - if($isresident) - $this->ptc[1] = 'STR'; + if ($isresident) { + $this->ptc[] = 'STR'; + $this->ptc[1] = $passengerType; + } else { + $this->ptc[] = $passengerType; + } } } From 1436e925b643b5a2ba5216c068948af9770231bf Mon Sep 17 00:00:00 2001 From: Giovanni Griani Date: Tue, 18 Sep 2018 11:29:40 +0200 Subject: [PATCH 61/86] profile messages --- src/Amadeus/Client.php | 197 ++++++++++++++---- src/Amadeus/Client/RequestCreator/Base.php | 2 +- .../Converter/Profile/CreateProfileConv.php | 25 +++ .../Converter/Profile/DeleteProfileConv.php | 25 +++ .../Converter/Profile/ReadProfileConv.php | 23 ++ .../Converter/Profile/UpdateProfileConv.php | 25 +++ .../ProfileCreateProfileOptions.php | 33 +++ .../ProfileDeleteProfileOptions.php | 31 +++ .../ProfileReadProfileOptions.php | 31 +++ .../ProfileUpdateProfileOptions.php | 31 +++ .../Client/Session/Handler/SoapHeader4.php | 16 +- .../Struct/Profile/ProfileCreateProfile.php | 28 +++ .../Struct/Profile/ProfileDeleteProfile.php | 26 +++ .../Struct/Profile/ProfileReadProfile.php | 27 +++ .../Struct/Profile/ProfileUpdateProfile.php | 29 +++ 15 files changed, 501 insertions(+), 48 deletions(-) create mode 100644 src/Amadeus/Client/RequestCreator/Converter/Profile/CreateProfileConv.php create mode 100644 src/Amadeus/Client/RequestCreator/Converter/Profile/DeleteProfileConv.php create mode 100644 src/Amadeus/Client/RequestCreator/Converter/Profile/ReadProfileConv.php create mode 100644 src/Amadeus/Client/RequestCreator/Converter/Profile/UpdateProfileConv.php create mode 100644 src/Amadeus/Client/RequestOptions/ProfileCreateProfileOptions.php create mode 100644 src/Amadeus/Client/RequestOptions/ProfileDeleteProfileOptions.php create mode 100644 src/Amadeus/Client/RequestOptions/ProfileReadProfileOptions.php create mode 100644 src/Amadeus/Client/RequestOptions/ProfileUpdateProfileOptions.php create mode 100644 src/Amadeus/Client/Struct/Profile/ProfileCreateProfile.php create mode 100644 src/Amadeus/Client/Struct/Profile/ProfileDeleteProfile.php create mode 100644 src/Amadeus/Client/Struct/Profile/ProfileReadProfile.php create mode 100644 src/Amadeus/Client/Struct/Profile/ProfileUpdateProfile.php diff --git a/src/Amadeus/Client.php b/src/Amadeus/Client.php index 26b44f777..6ddc5d09e 100644 --- a/src/Amadeus/Client.php +++ b/src/Amadeus/Client.php @@ -264,7 +264,8 @@ public function pnrRetrieve(RequestOptions\PnrRetrieveOptions $options, $message public function pnrSplit( RequestOptions\PnrSplitOptions $options, $messageOptions = [] - ) { + ) + { $msgName = 'PNR_Split'; return $this->callMessage($msgName, $options, $messageOptions); @@ -583,7 +584,8 @@ public function offerConfirmCar(RequestOptions\OfferConfirmCarOptions $options, public function fareMasterPricerTravelBoardSearch( RequestOptions\FareMasterPricerTbSearch $options, $messageOptions = [] - ) { + ) + { $msgName = 'Fare_MasterPricerTravelBoardSearch'; return $this->callMessage($msgName, $options, $messageOptions); @@ -602,7 +604,8 @@ public function fareMasterPricerTravelBoardSearch( public function fareMasterPricerCalendar( RequestOptions\FareMasterPricerCalendarOptions $options, $messageOptions = [] - ) { + ) + { $msgName = 'Fare_MasterPricerCalendar'; return $this->callMessage($msgName, $options, $messageOptions); @@ -621,7 +624,8 @@ public function fareMasterPricerCalendar( public function farePricePnrWithBookingClass( RequestOptions\FarePricePnrWithBookingClassOptions $options, $messageOptions = [] - ) { + ) + { $msgName = 'Fare_PricePNRWithBookingClass'; return $this->callMessage($msgName, $options, $messageOptions); @@ -640,7 +644,8 @@ public function farePricePnrWithBookingClass( public function farePricePnrWithLowerFares( RequestOptions\FarePricePnrWithLowerFaresOptions $options, $messageOptions = [] - ) { + ) + { $msgName = 'Fare_PricePNRWithLowerFares'; return $this->callMessage($msgName, $options, $messageOptions); @@ -659,7 +664,8 @@ public function farePricePnrWithLowerFares( public function farePricePnrWithLowestFare( RequestOptions\FarePricePnrWithLowestFareOptions $options, $messageOptions = [] - ) { + ) + { $msgName = 'Fare_PricePNRWithLowestFare'; return $this->callMessage($msgName, $options, $messageOptions); @@ -678,7 +684,8 @@ public function farePricePnrWithLowestFare( public function fareInformativePricingWithoutPnr( RequestOptions\FareInformativePricingWithoutPnrOptions $options, $messageOptions = [] - ) { + ) + { $msgName = 'Fare_InformativePricingWithoutPNR'; return $this->callMessage($msgName, $options, $messageOptions); @@ -697,7 +704,8 @@ public function fareInformativePricingWithoutPnr( public function fareInformativeBestPricingWithoutPnr( RequestOptions\FareInformativeBestPricingWithoutPnrOptions $options, $messageOptions = [] - ) { + ) + { $msgName = 'Fare_InformativeBestPricingWithoutPNR'; return $this->callMessage($msgName, $options, $messageOptions); @@ -767,7 +775,8 @@ public function fareConvertCurrency(RequestOptions\FareConvertCurrencyOptions $o public function airMultiAvailability( RequestOptions\AirMultiAvailabilityOptions $options, $messageOptions = [] - ) { + ) + { $msgName = 'Air_MultiAvailability'; return $this->callMessage($msgName, $options, $messageOptions); @@ -786,7 +795,8 @@ public function airMultiAvailability( public function airSellFromRecommendation( RequestOptions\AirSellFromRecommendationOptions $options, $messageOptions = [] - ) { + ) + { $msgName = 'Air_SellFromRecommendation'; return $this->callMessage($msgName, $options, $messageOptions); @@ -873,7 +883,8 @@ public function commandCryptic(RequestOptions\CommandCrypticOptions $options, $m public function miniRuleGetFromPricingRec( RequestOptions\MiniRuleGetFromPricingRecOptions $options, $messageOptions = [] - ) { + ) + { $msgName = 'MiniRule_GetFromPricingRec'; return $this->callMessage($msgName, $options, $messageOptions); @@ -892,7 +903,8 @@ public function miniRuleGetFromPricingRec( public function miniRuleGetFromPricing( RequestOptions\MiniRuleGetFromPricingOptions $options, $messageOptions = [] - ) { + ) + { $msgName = 'MiniRule_GetFromPricing'; return $this->callMessage($msgName, $options, $messageOptions); @@ -911,7 +923,8 @@ public function miniRuleGetFromPricing( public function miniRuleGetFromETicket( RequestOptions\MiniRuleGetFromETicketOptions $options, $messageOptions = [] - ) { + ) + { $msgName = 'MiniRule_GetFromETicket'; return $this->callMessage($msgName, $options, $messageOptions); @@ -965,7 +978,8 @@ public function pointOfRefSearch(RequestOptions\PointOfRefSearchOptions $options public function ticketCreateTSTFromPricing( RequestOptions\TicketCreateTstFromPricingOptions $options, $messageOptions = [] - ) { + ) + { $msgName = 'Ticket_CreateTSTFromPricing'; return $this->callMessage($msgName, $options, $messageOptions); @@ -984,7 +998,8 @@ public function ticketCreateTSTFromPricing( public function ticketCreateTSMFromPricing( RequestOptions\TicketCreateTsmFromPricingOptions $options, $messageOptions = [] - ) { + ) + { $msgName = 'Ticket_CreateTSMFromPricing'; return $this->callMessage($msgName, $options, $messageOptions); @@ -1003,7 +1018,8 @@ public function ticketCreateTSMFromPricing( public function ticketCreateTSMFareElement( RequestOptions\TicketCreateTsmFareElOptions $options, $messageOptions = [] - ) { + ) + { $msgName = 'Ticket_CreateTSMFareElement'; return $this->callMessage($msgName, $options, $messageOptions); @@ -1022,7 +1038,8 @@ public function ticketCreateTSMFareElement( public function ticketCreateTASF( RequestOptions\TicketCreateTasfOptions $options, $messageOptions = [] - ) { + ) + { $msgName = 'Ticket_CreateTASF'; return $this->callMessage($msgName, $options, $messageOptions); @@ -1109,7 +1126,8 @@ public function ticketDisplayTSMP(RequestOptions\TicketDisplayTsmpOptions $optio public function ticketRetrieveListOfTSM( RequestOptions\TicketRetrieveListOfTSMOptions $options, $messageOptions = [] - ) { + ) + { $msgName = 'Ticket_RetrieveListOfTSM'; return $this->callMessage($msgName, $options, $messageOptions); @@ -1128,7 +1146,8 @@ public function ticketRetrieveListOfTSM( public function ticketDisplayTSMFareElement( RequestOptions\TicketDisplayTsmFareElOptions $options, $messageOptions = [] - ) { + ) + { $msgName = 'Ticket_DisplayTSMFareElement'; return $this->callMessage($msgName, $options, $messageOptions); @@ -1147,7 +1166,8 @@ public function ticketDisplayTSMFareElement( public function ticketCheckEligibility( RequestOptions\TicketCheckEligibilityOptions $options, $messageOptions = [] - ) { + ) + { $msgName = 'Ticket_CheckEligibility'; return $this->callMessage($msgName, $options, $messageOptions); @@ -1166,7 +1186,8 @@ public function ticketCheckEligibility( public function ticketAtcShopperMasterPricerTravelBoardSearch( RequestOptions\TicketAtcShopperMpTbSearchOptions $options, $messageOptions = [] - ) { + ) + { $msgName = 'Ticket_ATCShopperMasterPricerTravelBoardSearch'; return $this->callMessage($msgName, $options, $messageOptions); @@ -1185,7 +1206,8 @@ public function ticketAtcShopperMasterPricerTravelBoardSearch( public function ticketRepricePnrWithBookingClass( RequestOptions\TicketRepricePnrWithBookingClassOptions $options, $messageOptions = [] - ) { + ) + { $msgName = 'Ticket_RepricePNRWithBookingClass'; return $this->callMessage($msgName, $options, $messageOptions); @@ -1204,7 +1226,8 @@ public function ticketRepricePnrWithBookingClass( public function ticketCancelDocument( RequestOptions\TicketCancelDocumentOptions $options, $messageOptions = [] - ) { + ) + { $msgName = 'Ticket_CancelDocument'; return $this->callMessage($msgName, $options, $messageOptions); @@ -1223,7 +1246,8 @@ public function ticketCancelDocument( public function ticketReissueConfirmedPricing( RequestOptions\TicketReissueConfirmedPricingOptions $options, $messageOptions = [] - ) { + ) + { $msgName = 'Ticket_ReissueConfirmedPricing'; return $this->callMessage($msgName, $options, $messageOptions); @@ -1276,7 +1300,8 @@ public function ticketProcessETicket(RequestOptions\TicketProcessETicketOptions public function docIssuanceIssueTicket( RequestOptions\DocIssuanceIssueTicketOptions $options, $messageOptions = [] - ) { + ) + { $msgName = 'DocIssuance_IssueTicket'; return $this->callMessage($msgName, $options, $messageOptions); @@ -1295,7 +1320,8 @@ public function docIssuanceIssueTicket( public function docIssuanceIssueMiscellaneousDocuments( RequestOptions\DocIssuanceIssueMiscDocOptions $options, $messageOptions = [] - ) { + ) + { $msgName = 'DocIssuance_IssueMiscellaneousDocuments'; return $this->callMessage($msgName, $options, $messageOptions); @@ -1314,7 +1340,8 @@ public function docIssuanceIssueMiscellaneousDocuments( public function docIssuanceIssueCombined( RequestOptions\DocIssuanceIssueCombinedOptions $options, $messageOptions = [] - ) { + ) + { $msgName = 'DocIssuance_IssueCombined'; return $this->callMessage($msgName, $options, $messageOptions); @@ -1333,7 +1360,8 @@ public function docIssuanceIssueCombined( public function docRefundInitRefund( RequestOptions\DocRefundInitRefundOptions $options, $messageOptions = [] - ) { + ) + { $msgName = 'DocRefund_InitRefund'; return $this->callMessage($msgName, $options, $messageOptions); @@ -1352,7 +1380,8 @@ public function docRefundInitRefund( public function docRefundIgnoreRefund( RequestOptions\DocRefundIgnoreRefundOptions $options, $messageOptions = [] - ) { + ) + { $msgName = 'DocRefund_IgnoreRefund'; return $this->callMessage($msgName, $options, $messageOptions); @@ -1371,7 +1400,8 @@ public function docRefundIgnoreRefund( public function docRefundUpdateRefund( RequestOptions\DocRefundUpdateRefundOptions $options, $messageOptions = [] - ) { + ) + { $msgName = 'DocRefund_UpdateRefund'; return $this->callMessage($msgName, $options, $messageOptions); @@ -1390,7 +1420,8 @@ public function docRefundUpdateRefund( public function docRefundProcessRefund( RequestOptions\DocRefundProcessRefundOptions $options, $messageOptions = [] - ) { + ) + { $msgName = 'DocRefund_ProcessRefund'; return $this->callMessage($msgName, $options, $messageOptions); @@ -1409,7 +1440,8 @@ public function docRefundProcessRefund( public function ticketInitRefund( RequestOptions\TicketInitRefundOptions $options, $messageOptions = [] - ) { + ) + { $msgName = 'Ticket_InitRefund'; return $this->callMessage($msgName, $options, $messageOptions); @@ -1428,7 +1460,8 @@ public function ticketInitRefund( public function ticketIgnoreRefund( RequestOptions\TicketIgnoreRefundOptions $options, $messageOptions = [] - ) { + ) + { $msgName = 'Ticket_IgnoreRefund'; return $this->callMessage($msgName, $options, $messageOptions); @@ -1447,7 +1480,8 @@ public function ticketIgnoreRefund( public function ticketProcessRefund( RequestOptions\TicketProcessRefundOptions $options, $messageOptions = [] - ) { + ) + { $msgName = 'Ticket_ProcessRefund'; return $this->callMessage($msgName, $options, $messageOptions); @@ -1501,7 +1535,8 @@ public function fopValidateFOP(RequestOptions\FopValidateFopOptions $options, $m public function priceXplorerExtremeSearch( RequestOptions\PriceXplorerExtremeSearchOptions $options, $messageOptions = [] - ) { + ) + { $msgName = 'PriceXplorer_ExtremeSearch'; return $this->callMessage($msgName, $options, $messageOptions); @@ -1520,7 +1555,8 @@ public function priceXplorerExtremeSearch( public function salesReportsDisplayQueryReport( RequestOptions\SalesReportsDisplayQueryReportOptions $options, $messageOptions = [] - ) { + ) + { $msgName = 'SalesReports_DisplayQueryReport'; return $this->callMessage($msgName, $options, $messageOptions); @@ -1539,7 +1575,8 @@ public function salesReportsDisplayQueryReport( public function serviceIntegratedPricing( RequestOptions\ServiceIntegratedPricingOptions $options, $messageOptions = [] - ) { + ) + { $msgName = 'Service_IntegratedPricing'; return $this->callMessage($msgName, $options, $messageOptions); @@ -1558,7 +1595,8 @@ public function serviceIntegratedPricing( public function serviceIntegratedCatalogue( RequestOptions\ServiceIntegratedCatalogueOptions $options, $messageOptions = [] - ) { + ) + { $msgName = 'Service_IntegratedCatalogue'; return $this->callMessage($msgName, $options, $messageOptions); @@ -1649,9 +1687,90 @@ protected function makeMessageOptions(array $incoming, $endSession = false) public function farePriceUpsellWithoutPnr( RequestOptions\FarePriceUpsellWithoutPNROptions $options, $messageOptions = [] - ) { + ) + { $msgName = 'Fare_PriceUpsellWithoutPNR'; return $this->callMessage($msgName, $options, $messageOptions); } + + /** + * Profile_ReadProfile + * + * @param RequestOptions\ProfileReadProfileOptions $options + * @param array $messageOptions (OPTIONAL) + * @return Result + * @throws Client\InvalidMessageException + * @throws Client\RequestCreator\MessageVersionUnsupportedException + * @throws Exception + */ + public function profileReadProfile( + RequestOptions\ProfileReadProfileOptions $options, + $messageOptions = [] + ) + { + $msgName = 'Profile_ReadProfile'; + + return $this->callMessage($msgName, $options, $messageOptions); + } + + /** + * Profile_CreateProfile + * + * @param RequestOptions\ProfileReadProfileOptions $options + * @param array $messageOptions (OPTIONAL) + * @return Result + * @throws Client\InvalidMessageException + * @throws Client\RequestCreator\MessageVersionUnsupportedException + * @throws Exception + */ + public function profileCreateProfile( + RequestOptions\ProfileCreateProfileOptions $options, + $messageOptions = [] + ) + { + $msgName = 'Profile_CreateProfile'; + + return $this->callMessage($msgName, $options, $messageOptions); + } + + /** + * Profile_CreateProfile + * + * @param RequestOptions\ProfileReadProfileOptions $options + * @param array $messageOptions (OPTIONAL) + * @return Result + * @throws Client\InvalidMessageException + * @throws Client\RequestCreator\MessageVersionUnsupportedException + * @throws Exception + */ + public function profileDeleteProfile( + RequestOptions\ProfileDeleteProfileOptions $options, + $messageOptions = [] + ) + { + $msgName = 'Profile_DeleteProfile'; + + return $this->callMessage($msgName, $options, $messageOptions); + } + + /** + * Profile_UpdateProfile + * + * @param RequestOptions\ProfileUpdateProfileOptions $options + * @param array $messageOptions (OPTIONAL) + * @return Result + * @throws Client\InvalidMessageException + * @throws Client\RequestCreator\MessageVersionUnsupportedException + * @throws Exception + */ + public function profileUpdateProfile( + RequestOptions\ProfileUpdateProfileOptions $options, + $messageOptions = [] + ) + { + $msgName = 'Profile_UpdateProfile'; + + return $this->callMessage($msgName, $options, $messageOptions); + } } diff --git a/src/Amadeus/Client/RequestCreator/Base.php b/src/Amadeus/Client/RequestCreator/Base.php index a04d3d6e4..e6a78326f 100644 --- a/src/Amadeus/Client/RequestCreator/Base.php +++ b/src/Amadeus/Client/RequestCreator/Base.php @@ -154,7 +154,7 @@ protected function findBuilderForMessage($messageName) $message = substr($messageName, strpos($messageName, '_') + 1); $builderClass = __NAMESPACE__.'\\Converter\\'.$section.'\\'.$message."Conv"; - +print_r($builderClass); if (class_exists($builderClass)) { /** @var ConvertInterface $builder */ $builder = new $builderClass(); diff --git a/src/Amadeus/Client/RequestCreator/Converter/Profile/CreateProfileConv.php b/src/Amadeus/Client/RequestCreator/Converter/Profile/CreateProfileConv.php new file mode 100644 index 000000000..525c1bbae --- /dev/null +++ b/src/Amadeus/Client/RequestCreator/Converter/Profile/CreateProfileConv.php @@ -0,0 +1,25 @@ + $propValue) { + if (property_exists($this, $propName)) { + $this->$propName = $propValue; + } + } + } +} \ No newline at end of file diff --git a/src/Amadeus/Client/RequestOptions/ProfileDeleteProfileOptions.php b/src/Amadeus/Client/RequestOptions/ProfileDeleteProfileOptions.php new file mode 100644 index 000000000..9403dcd83 --- /dev/null +++ b/src/Amadeus/Client/RequestOptions/ProfileDeleteProfileOptions.php @@ -0,0 +1,31 @@ + $propValue) { + if (property_exists($this, $propName)) { + $this->$propName = $propValue; + } + } + } +} \ No newline at end of file diff --git a/src/Amadeus/Client/RequestOptions/ProfileReadProfileOptions.php b/src/Amadeus/Client/RequestOptions/ProfileReadProfileOptions.php new file mode 100644 index 000000000..e0c66598c --- /dev/null +++ b/src/Amadeus/Client/RequestOptions/ProfileReadProfileOptions.php @@ -0,0 +1,31 @@ + $propValue) { + if (property_exists($this, $propName)) { + $this->$propName = $propValue; + } + } + } +} \ No newline at end of file diff --git a/src/Amadeus/Client/RequestOptions/ProfileUpdateProfileOptions.php b/src/Amadeus/Client/RequestOptions/ProfileUpdateProfileOptions.php new file mode 100644 index 000000000..4a946a01b --- /dev/null +++ b/src/Amadeus/Client/RequestOptions/ProfileUpdateProfileOptions.php @@ -0,0 +1,31 @@ + $propValue) { + if (property_exists($this, $propName)) { + $this->$propName = $propValue; + } + } + } +} \ No newline at end of file diff --git a/src/Amadeus/Client/Session/Handler/SoapHeader4.php b/src/Amadeus/Client/Session/Handler/SoapHeader4.php index 2891b413f..5043c5852 100644 --- a/src/Amadeus/Client/Session/Handler/SoapHeader4.php +++ b/src/Amadeus/Client/Session/Handler/SoapHeader4.php @@ -206,7 +206,7 @@ protected function getSessionDataFromHeader($responseMsg) $newSessionData['sessionId'] = $responseDomXpath->evaluate($querySessionId); $newSessionData['sequenceNumber'] = $responseDomXpath->evaluate($querySequenceNumber); if (!empty($newSessionData['sequenceNumber'])) { - $newSessionData['sequenceNumber'] = (int) $newSessionData['sequenceNumber']; + $newSessionData['sequenceNumber'] = (int)$newSessionData['sequenceNumber']; } $newSessionData['securityToken'] = $responseDomXpath->evaluate($querySecurityToken); } @@ -408,15 +408,15 @@ protected function getActionFromWsdl($wsdlFilePath, $messageName) */ protected function generateGuid() { - mt_srand((double) microtime() * 10000); + mt_srand((double)microtime() * 10000); $charId = strtoupper(md5(uniqid(rand(), true))); $hyphen = chr(45); // "-" - $uuid = substr($charId, 0, 8).$hyphen - .substr($charId, 8, 4).$hyphen - .substr($charId, 12, 4).$hyphen - .substr($charId, 16, 4).$hyphen - .substr($charId, 20, 12); + $uuid = substr($charId, 0, 8) . $hyphen + . substr($charId, 8, 4) . $hyphen + . substr($charId, 12, 4) . $hyphen + . substr($charId, 16, 4) . $hyphen + . substr($charId, 20, 12); return $uuid; } @@ -454,7 +454,7 @@ protected function generateUniqueNonce($nonceBase, $creationString) true ), 0, - 16 + 20 ); } diff --git a/src/Amadeus/Client/Struct/Profile/ProfileCreateProfile.php b/src/Amadeus/Client/Struct/Profile/ProfileCreateProfile.php new file mode 100644 index 000000000..d5ea7853e --- /dev/null +++ b/src/Amadeus/Client/Struct/Profile/ProfileCreateProfile.php @@ -0,0 +1,28 @@ +Version= $options->Version; + $this->UniqueID= $options->UniqueID; + $this->Profile= $options->Profile; + $this->CompanyName= $options->CompanyName; + } + } +} \ No newline at end of file diff --git a/src/Amadeus/Client/Struct/Profile/ProfileDeleteProfile.php b/src/Amadeus/Client/Struct/Profile/ProfileDeleteProfile.php new file mode 100644 index 000000000..4159351fe --- /dev/null +++ b/src/Amadeus/Client/Struct/Profile/ProfileDeleteProfile.php @@ -0,0 +1,26 @@ +Version= $options->Version; + $this->UniqueID= $options->UniqueID; + $this->DeleteRequests= $options->DeleteRequests; + } + } +} \ No newline at end of file diff --git a/src/Amadeus/Client/Struct/Profile/ProfileReadProfile.php b/src/Amadeus/Client/Struct/Profile/ProfileReadProfile.php new file mode 100644 index 000000000..933015673 --- /dev/null +++ b/src/Amadeus/Client/Struct/Profile/ProfileReadProfile.php @@ -0,0 +1,27 @@ +Version= $options->Version; + $this->UniqueID= $options->UniqueID; + $this->ReadRequests= $options->ReadRequests; + } + } +} \ No newline at end of file diff --git a/src/Amadeus/Client/Struct/Profile/ProfileUpdateProfile.php b/src/Amadeus/Client/Struct/Profile/ProfileUpdateProfile.php new file mode 100644 index 000000000..d4b6f3a03 --- /dev/null +++ b/src/Amadeus/Client/Struct/Profile/ProfileUpdateProfile.php @@ -0,0 +1,29 @@ + $propValue) { + if (property_exists($this, $propName)) { + $this->$propName = $propValue; + } + } + } + } +} \ No newline at end of file From fb45409f058d9c66df2694407554c51b3e3d85ce Mon Sep 17 00:00:00 2001 From: Giovanni Griani Date: Tue, 18 Sep 2018 18:00:54 +0200 Subject: [PATCH 62/86] this resolve the issue when messagebody is empty for some reasons --- src/Amadeus/Client/Util/MsgBodyExtractor.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Amadeus/Client/Util/MsgBodyExtractor.php b/src/Amadeus/Client/Util/MsgBodyExtractor.php index 59ec1c484..5a5b7c3ff 100644 --- a/src/Amadeus/Client/Util/MsgBodyExtractor.php +++ b/src/Amadeus/Client/Util/MsgBodyExtractor.php @@ -65,6 +65,9 @@ public static function extract($soapResponse) } } + if(empty($messageBody)){ + $messageBody = $soapResponse; + } return $messageBody; } } From 2d575d4c5051559a606b6b3eb105dd4028495bf2 Mon Sep 17 00:00:00 2001 From: Giovanni Griani Date: Wed, 19 Sep 2018 08:59:20 +0200 Subject: [PATCH 63/86] eleminato print_r --- src/Amadeus/Client/RequestCreator/Base.php | 1 - .../Struct/Fare/InformativePriceUpsellWithoutPNR16Test.php | 1 - 2 files changed, 2 deletions(-) diff --git a/src/Amadeus/Client/RequestCreator/Base.php b/src/Amadeus/Client/RequestCreator/Base.php index e6a78326f..560457dd6 100644 --- a/src/Amadeus/Client/RequestCreator/Base.php +++ b/src/Amadeus/Client/RequestCreator/Base.php @@ -154,7 +154,6 @@ protected function findBuilderForMessage($messageName) $message = substr($messageName, strpos($messageName, '_') + 1); $builderClass = __NAMESPACE__.'\\Converter\\'.$section.'\\'.$message."Conv"; -print_r($builderClass); if (class_exists($builderClass)) { /** @var ConvertInterface $builder */ $builder = new $builderClass(); diff --git a/tests/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR16Test.php b/tests/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR16Test.php index 222ba0408..2d3f98109 100644 --- a/tests/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR16Test.php +++ b/tests/Amadeus/Client/Struct/Fare/InformativePriceUpsellWithoutPNR16Test.php @@ -88,7 +88,6 @@ public function test51OperationFullExample() $this->assertCount(2, $msg->passengersGroup); - print_r($msg->passengersGroup[0]->discountPtc->valueQualifier); $this->assertEquals('ADT', $msg->passengersGroup[0]->discountPtc->valueQualifier); $this->assertCount(1, $msg->passengersGroup[0]->travellersID->travellerDetails); $this->assertEquals(1, $msg->passengersGroup[0]->travellersID->travellerDetails[0]->measurementValue); From e87cd3434b67deedfbef796f4dac509a2f350caa Mon Sep 17 00:00:00 2001 From: Giovanni Griani Date: Thu, 27 Sep 2018 12:14:05 +0200 Subject: [PATCH 64/86] gestione attributeDescription in criteriaDetails --- .../Client/Struct/Fare/PricePNRWithBookingClass13.php | 5 ++++- .../Client/Struct/Fare/PricePnr13/CriteriaDetails.php | 4 +++- src/Amadeus/Client/Struct/Fare/PricePnr13/OptionDetail.php | 4 ++-- .../Client/Struct/Fare/PricePnr13/PricingOptionGroup.php | 7 +++++-- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/Amadeus/Client/Struct/Fare/PricePNRWithBookingClass13.php b/src/Amadeus/Client/Struct/Fare/PricePNRWithBookingClass13.php index aa5812414..93940290c 100644 --- a/src/Amadeus/Client/Struct/Fare/PricePNRWithBookingClass13.php +++ b/src/Amadeus/Client/Struct/Fare/PricePNRWithBookingClass13.php @@ -213,7 +213,10 @@ protected static function makeOverrideOptionsWithCriteria($overrideOptionsWithCr foreach ($overrideOptionsWithCriteria as $overrideOptionWithCriteria) { if (!self::hasPricingGroup($overrideOptionWithCriteria["key"], $priceOptions)) { - $opt[] = new PricingOptionGroup($overrideOptionWithCriteria["key"], $overrideOptionWithCriteria["optionDetail"]); + if(!isset($overrideOptionWithCriteria["attributeDescription"])) + $opt[] = new PricingOptionGroup($overrideOptionWithCriteria["key"], $overrideOptionWithCriteria["optionDetail"]); + else + $opt[] = new PricingOptionGroup($overrideOptionWithCriteria["key"], $overrideOptionWithCriteria["optionDetail"],$overrideOptionWithCriteria["attributeDescription"]); } } diff --git a/src/Amadeus/Client/Struct/Fare/PricePnr13/CriteriaDetails.php b/src/Amadeus/Client/Struct/Fare/PricePnr13/CriteriaDetails.php index f71f8fd50..d5f15a9bd 100644 --- a/src/Amadeus/Client/Struct/Fare/PricePnr13/CriteriaDetails.php +++ b/src/Amadeus/Client/Struct/Fare/PricePnr13/CriteriaDetails.php @@ -45,8 +45,10 @@ class CriteriaDetails * * @param string $type */ - public function __construct($type) + public function __construct($type, $description = null) { $this->attributeType = $type; + if (isset($description)) + $this->attributeDescription = $description; } } diff --git a/src/Amadeus/Client/Struct/Fare/PricePnr13/OptionDetail.php b/src/Amadeus/Client/Struct/Fare/PricePnr13/OptionDetail.php index 39d4d9698..771da6882 100644 --- a/src/Amadeus/Client/Struct/Fare/PricePnr13/OptionDetail.php +++ b/src/Amadeus/Client/Struct/Fare/PricePnr13/OptionDetail.php @@ -40,10 +40,10 @@ class OptionDetail * * @param string|array|null $options */ - public function __construct($options = null) + public function __construct($options = null, $attributeDescription = null) { if (is_string($options)) { - $this->criteriaDetails[] = new CriteriaDetails($options); + $this->criteriaDetails[] = new CriteriaDetails($options, $attributeDescription); } elseif (is_array($options)) { foreach ($options as $option) { $this->criteriaDetails[] = new CriteriaDetails($option); diff --git a/src/Amadeus/Client/Struct/Fare/PricePnr13/PricingOptionGroup.php b/src/Amadeus/Client/Struct/Fare/PricePnr13/PricingOptionGroup.php index 89afdc2e2..8d303fde0 100644 --- a/src/Amadeus/Client/Struct/Fare/PricePnr13/PricingOptionGroup.php +++ b/src/Amadeus/Client/Struct/Fare/PricePnr13/PricingOptionGroup.php @@ -90,17 +90,20 @@ class PricingOptionGroup */ public $paxSegTstReference; + public $attributeDescription; + /** * PricingOptionGroup constructor. * * @param string $key * @param string $optionDetail + * @param string $attributeDescription */ - public function __construct($key, $optionDetail=null) + public function __construct($key, $optionDetail = null, $attributeDescription = null) { $this->pricingOptionKey = new PricingOptionKey($key); if (isset($optionDetail)) { - $this->optionDetail = new OptionDetail($optionDetail); + $this->optionDetail = new OptionDetail($optionDetail,$attributeDescription); } } } From 561d1219e870245bcc111d28721de146f36f1224 Mon Sep 17 00:00:00 2001 From: Giovanni Griani Date: Mon, 1 Oct 2018 16:41:06 +0200 Subject: [PATCH 65/86] Price with booking class upsell --- src/Amadeus/Client/RequestCreator/Base.php | 1 - .../Struct/Fare/PricePNRWithBookingClass13.php | 11 +++++------ .../Struct/Fare/PricePnr13/CriteriaDetails.php | 11 ++++++++++- .../Client/Struct/Fare/PricePnr13/OptionDetail.php | 6 +++--- .../Struct/Fare/PricePnr13/PricingOptionGroup.php | 14 +++++++++++--- 5 files changed, 29 insertions(+), 14 deletions(-) diff --git a/src/Amadeus/Client/RequestCreator/Base.php b/src/Amadeus/Client/RequestCreator/Base.php index 560457dd6..344e08076 100644 --- a/src/Amadeus/Client/RequestCreator/Base.php +++ b/src/Amadeus/Client/RequestCreator/Base.php @@ -88,7 +88,6 @@ public function createRequest($messageName, RequestOptionsInterface $params) $this->checkMessageIsInWsdl($messageName); $builder = $this->findBuilderForMessage($messageName); - if ($builder instanceof ConvertInterface) { return $builder->convert($params, $this->getActiveVersionFor($messageName)); } else { diff --git a/src/Amadeus/Client/Struct/Fare/PricePNRWithBookingClass13.php b/src/Amadeus/Client/Struct/Fare/PricePNRWithBookingClass13.php index 93940290c..3b2fae0a8 100644 --- a/src/Amadeus/Client/Struct/Fare/PricePNRWithBookingClass13.php +++ b/src/Amadeus/Client/Struct/Fare/PricePNRWithBookingClass13.php @@ -209,14 +209,13 @@ protected static function makeOverrideOptions($overrideOptions, $priceOptions) */ protected static function makeOverrideOptionsWithCriteria($overrideOptionsWithCriteria, $priceOptions) { - $opt = []; + $opt = []; foreach ($overrideOptionsWithCriteria as $overrideOptionWithCriteria) { + if (!self::hasPricingGroup($overrideOptionWithCriteria["key"], $priceOptions)) { - if(!isset($overrideOptionWithCriteria["attributeDescription"])) - $opt[] = new PricingOptionGroup($overrideOptionWithCriteria["key"], $overrideOptionWithCriteria["optionDetail"]); - else - $opt[] = new PricingOptionGroup($overrideOptionWithCriteria["key"], $overrideOptionWithCriteria["optionDetail"],$overrideOptionWithCriteria["attributeDescription"]); + $opt[] = new PricingOptionGroup($overrideOptionWithCriteria["key"], $overrideOptionWithCriteria["optionDetail"], $overrideOptionWithCriteria["attributeDescription"], $overrideOptionWithCriteria["references"]); + } } @@ -275,7 +274,7 @@ protected static function makePricingOptionFareBasisOverride($pricingsFareBasis) //Support for legacy fareBasisPrimaryCode to be removed when breaking BC: $po->optionDetail = new OptionDetail( - $pricingFareBasis->fareBasisPrimaryCode.$pricingFareBasis->fareBasisCode + $pricingFareBasis->fareBasisPrimaryCode . $pricingFareBasis->fareBasisCode ); //Support for legacy segmentReference to be removed when breaking BC: diff --git a/src/Amadeus/Client/Struct/Fare/PricePnr13/CriteriaDetails.php b/src/Amadeus/Client/Struct/Fare/PricePnr13/CriteriaDetails.php index d5f15a9bd..3c5bffbe4 100644 --- a/src/Amadeus/Client/Struct/Fare/PricePnr13/CriteriaDetails.php +++ b/src/Amadeus/Client/Struct/Fare/PricePnr13/CriteriaDetails.php @@ -40,15 +40,24 @@ class CriteriaDetails */ public $attributeDescription; + /** + * Passenger, Segment or TST references to partially price the PNR + * + * @var PaxSegRef[] + */ + public $paxSegTstReference = []; + /** * CriteriaDetails constructor. * * @param string $type */ - public function __construct($type, $description = null) + public function __construct($type, $description = null, $references = null) { $this->attributeType = $type; if (isset($description)) $this->attributeDescription = $description; + if (isset($references)) + $this->paxSegTstReference = $references; } } diff --git a/src/Amadeus/Client/Struct/Fare/PricePnr13/OptionDetail.php b/src/Amadeus/Client/Struct/Fare/PricePnr13/OptionDetail.php index 771da6882..1cc8ba809 100644 --- a/src/Amadeus/Client/Struct/Fare/PricePnr13/OptionDetail.php +++ b/src/Amadeus/Client/Struct/Fare/PricePnr13/OptionDetail.php @@ -40,13 +40,13 @@ class OptionDetail * * @param string|array|null $options */ - public function __construct($options = null, $attributeDescription = null) + public function __construct($options = null, $attributeDescription = null, $references = null) { if (is_string($options)) { - $this->criteriaDetails[] = new CriteriaDetails($options, $attributeDescription); + $this->criteriaDetails[] = new CriteriaDetails($options, $attributeDescription, $references); } elseif (is_array($options)) { foreach ($options as $option) { - $this->criteriaDetails[] = new CriteriaDetails($option); + $this->criteriaDetails[] = new CriteriaDetails($options, $attributeDescription, $references); } } } diff --git a/src/Amadeus/Client/Struct/Fare/PricePnr13/PricingOptionGroup.php b/src/Amadeus/Client/Struct/Fare/PricePnr13/PricingOptionGroup.php index 8d303fde0..6149ebd67 100644 --- a/src/Amadeus/Client/Struct/Fare/PricePnr13/PricingOptionGroup.php +++ b/src/Amadeus/Client/Struct/Fare/PricePnr13/PricingOptionGroup.php @@ -89,9 +89,14 @@ class PricingOptionGroup * @var PaxSegTstReference */ public $paxSegTstReference; - + /** + * @var $attributeDescription + */ public $attributeDescription; + + public $references = []; + /** * PricingOptionGroup constructor. * @@ -99,11 +104,14 @@ class PricingOptionGroup * @param string $optionDetail * @param string $attributeDescription */ - public function __construct($key, $optionDetail = null, $attributeDescription = null) + public function __construct($key, $optionDetail = null, $attributeDescription = null, $references = null) { $this->pricingOptionKey = new PricingOptionKey($key); + if(isset($references)){ + $this->paxSegTstReference = new PaxSegTstReference($references); + } if (isset($optionDetail)) { - $this->optionDetail = new OptionDetail($optionDetail,$attributeDescription); + $this->optionDetail = new OptionDetail($optionDetail, $attributeDescription, $references); } } } From f6e417d502b0a8f51109b55b75f1d21cd358273a Mon Sep 17 00:00:00 2001 From: Giovanni Griani Date: Tue, 2 Oct 2018 11:10:22 +0200 Subject: [PATCH 66/86] gestione attributeDescription in criteriaDetails --- src/Amadeus/Client/Struct/Fare/PricePNRWithBookingClass13.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Amadeus/Client/Struct/Fare/PricePNRWithBookingClass13.php b/src/Amadeus/Client/Struct/Fare/PricePNRWithBookingClass13.php index 3b2fae0a8..7bec12e85 100644 --- a/src/Amadeus/Client/Struct/Fare/PricePNRWithBookingClass13.php +++ b/src/Amadeus/Client/Struct/Fare/PricePNRWithBookingClass13.php @@ -214,7 +214,9 @@ protected static function makeOverrideOptionsWithCriteria($overrideOptionsWithCr foreach ($overrideOptionsWithCriteria as $overrideOptionWithCriteria) { if (!self::hasPricingGroup($overrideOptionWithCriteria["key"], $priceOptions)) { - $opt[] = new PricingOptionGroup($overrideOptionWithCriteria["key"], $overrideOptionWithCriteria["optionDetail"], $overrideOptionWithCriteria["attributeDescription"], $overrideOptionWithCriteria["references"]); + $opt[] = new PricingOptionGroup($overrideOptionWithCriteria["key"], $overrideOptionWithCriteria["optionDetail"], + isset($overrideOptionWithCriteria["attributeDescription"]) ? $overrideOptionWithCriteria["attributeDescription"] : null, + isset($overrideOptionWithCriteria["references"]) ? $overrideOptionWithCriteria["references"] : null); } } From 95f77eeecd98a9366d68235cd8e72c782ed6cdcf Mon Sep 17 00:00:00 2001 From: Giovanni Griani Date: Wed, 10 Oct 2018 17:05:11 +0200 Subject: [PATCH 67/86] residents --- .../FarePricePnrWithBookingClassOptions.php | 2 ++ .../Client/Struct/Fare/PricePNRWithBookingClass13.php | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/Amadeus/Client/RequestOptions/FarePricePnrWithBookingClassOptions.php b/src/Amadeus/Client/RequestOptions/FarePricePnrWithBookingClassOptions.php index 549717c68..1154939a2 100644 --- a/src/Amadeus/Client/RequestOptions/FarePricePnrWithBookingClassOptions.php +++ b/src/Amadeus/Client/RequestOptions/FarePricePnrWithBookingClassOptions.php @@ -271,4 +271,6 @@ class FarePricePnrWithBookingClassOptions extends Base * @var PaxSegRef[] */ public $references = []; + + public $priceOptions = []; } diff --git a/src/Amadeus/Client/Struct/Fare/PricePNRWithBookingClass13.php b/src/Amadeus/Client/Struct/Fare/PricePNRWithBookingClass13.php index 7bec12e85..4fa631c1b 100644 --- a/src/Amadeus/Client/Struct/Fare/PricePNRWithBookingClass13.php +++ b/src/Amadeus/Client/Struct/Fare/PricePNRWithBookingClass13.php @@ -176,6 +176,16 @@ public static function loadPricingOptionsFromRequestOptions($options) self::makeOverrideOptionsWithCriteria($options->overrideOptionsWithCriteria, $priceOptions) ); + /* + $priceOptions = self::mergeOptions( + $priceOptions, + self::loadPaxDiscount($options->paxDiscountCodes, $options->paxDiscountCodeRefs) + ); +*/ + if (!empty($options->priceOptions)) + for ($i = 0; $i < count($options->priceOptions); $i++) + $priceOptions[] = $options->priceOptions[$i]; + // All options processed, no options found: if (empty($priceOptions)) { $priceOptions[] = new PricingOptionGroup(PricingOptionKey::OPTION_NO_OPTION); From 41fa324bf5822c5bb09d03113831048afcf5432a Mon Sep 17 00:00:00 2001 From: Giovanni Griani Date: Thu, 11 Oct 2018 10:07:43 +0200 Subject: [PATCH 68/86] Tolta la firma del vendor --- src/Amadeus/Client.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Amadeus/Client.php b/src/Amadeus/Client.php index 6ddc5d09e..1e508f7a4 100644 --- a/src/Amadeus/Client.php +++ b/src/Amadeus/Client.php @@ -65,7 +65,7 @@ class Client extends Base * * @var string */ - const RECEIVED_FROM_IDENTIFIER = "amabnl-amadeus-ws-client"; + const RECEIVED_FROM_IDENTIFIER = ""; /** * @var string From 63f8767d9982016891a63a4dc628543d1e3f940d Mon Sep 17 00:00:00 2001 From: Giovanni Griani Date: Mon, 15 Oct 2018 10:43:14 +0200 Subject: [PATCH 69/86] PNR_CreateTsm --- src/Amadeus/Client.php | 20 ++++++++++++++ .../Converter/PNR/CreateTSMConv.php | 21 +++++++++++++++ .../RequestOptions/PnrCreateTsmOptions.php | 26 +++++++++++++++++++ src/Amadeus/Client/Struct/Pnr/CreateTsm.php | 24 +++++++++++++++++ 4 files changed, 91 insertions(+) create mode 100644 src/Amadeus/Client/RequestCreator/Converter/PNR/CreateTSMConv.php create mode 100644 src/Amadeus/Client/RequestOptions/PnrCreateTsmOptions.php create mode 100644 src/Amadeus/Client/Struct/Pnr/CreateTsm.php diff --git a/src/Amadeus/Client.php b/src/Amadeus/Client.php index 1e508f7a4..cbf0a8d01 100644 --- a/src/Amadeus/Client.php +++ b/src/Amadeus/Client.php @@ -1773,4 +1773,24 @@ public function profileUpdateProfile( return $this->callMessage($msgName, $options, $messageOptions); } + + /** + * PNR_CreateTSM + * + * @param RequestOptions\PnrCreateTsmOptions $options + * @param array $messageOptions (OPTIONAL) + * @return Result + * @throws Client\InvalidMessageException + * @throws Client\RequestCreator\MessageVersionUnsupportedException + * @throws Exception + */ + public function createTasf( + RequestOptions\PnrCreateTsmOptions $options, + $messageOptions = [] + ) + { + $msgName = 'PNR_CreateTSM'; + + return $this->callMessage($msgName, $options, $messageOptions); + } } diff --git a/src/Amadeus/Client/RequestCreator/Converter/PNR/CreateTSMConv.php b/src/Amadeus/Client/RequestCreator/Converter/PNR/CreateTSMConv.php new file mode 100644 index 000000000..a02cc4879 --- /dev/null +++ b/src/Amadeus/Client/RequestCreator/Converter/PNR/CreateTSMConv.php @@ -0,0 +1,21 @@ + $propValue) { + if (property_exists($this, $propName)) { + $this->$propName = $propValue; + } + } + } +} \ No newline at end of file diff --git a/src/Amadeus/Client/Struct/Pnr/CreateTsm.php b/src/Amadeus/Client/Struct/Pnr/CreateTsm.php new file mode 100644 index 000000000..e73c28cc3 --- /dev/null +++ b/src/Amadeus/Client/Struct/Pnr/CreateTsm.php @@ -0,0 +1,24 @@ +msg = $options->msg; + $this->mcoData = $options->mcoData; + } + } +} \ No newline at end of file From 4c8962aabdd30e47eeb0fb2c63c7a1d991e4aa63 Mon Sep 17 00:00:00 2001 From: Giovanni Griani Date: Thu, 18 Oct 2018 15:47:03 +0200 Subject: [PATCH 70/86] Integretedpricing con Optionwithcriteria --- .../Fare/InformativePricing/Segment.php | 1 + .../ServiceIntegratedPricingOptions.php | 2 ++ .../Struct/Service/IntegratedPricing.php | 26 +++++++++++++++++++ 3 files changed, 29 insertions(+) diff --git a/src/Amadeus/Client/RequestOptions/Fare/InformativePricing/Segment.php b/src/Amadeus/Client/RequestOptions/Fare/InformativePricing/Segment.php index fdf8b0143..69961d5e7 100644 --- a/src/Amadeus/Client/RequestOptions/Fare/InformativePricing/Segment.php +++ b/src/Amadeus/Client/RequestOptions/Fare/InformativePricing/Segment.php @@ -129,4 +129,5 @@ class Segment extends LoadParamsFromArray * @var array */ public $inventory = []; + } diff --git a/src/Amadeus/Client/RequestOptions/ServiceIntegratedPricingOptions.php b/src/Amadeus/Client/RequestOptions/ServiceIntegratedPricingOptions.php index f50e143a9..a1f1bebf6 100755 --- a/src/Amadeus/Client/RequestOptions/ServiceIntegratedPricingOptions.php +++ b/src/Amadeus/Client/RequestOptions/ServiceIntegratedPricingOptions.php @@ -173,4 +173,6 @@ class ServiceIntegratedPricingOptions extends Base * @var PaxSegRef[] */ public $references = []; + + public $overrideOptionsWithCriteria=[]; } diff --git a/src/Amadeus/Client/Struct/Service/IntegratedPricing.php b/src/Amadeus/Client/Struct/Service/IntegratedPricing.php index 5afbf5744..d2c368222 100755 --- a/src/Amadeus/Client/Struct/Service/IntegratedPricing.php +++ b/src/Amadeus/Client/Struct/Service/IntegratedPricing.php @@ -138,6 +138,10 @@ public static function loadPricingOptions($options) $priceOptions = self::mergeOptions($priceOptions, self::makeOverrideOptions($options->overrideOptions, $priceOptions) ); + $priceOptions = self::mergeOptions( + $priceOptions, + self::makeOverrideOptionsWithCriteria($options->overrideOptionsWithCriteria, $priceOptions) + ); // All options processed, no options found: if (empty($priceOptions)) { $priceOptions[] = new PricingOption(PricingOptionKey::OVERRIDE_NO_OPTION); @@ -146,6 +150,28 @@ public static function loadPricingOptions($options) return $priceOptions; } + /** + * @param string[] $overrideOptionsWithCriteria + * @param PricingOptionGroup[] $priceOptions + * @return PricingOptionGroup[] + */ + protected static function makeOverrideOptionsWithCriteria($overrideOptionsWithCriteria, $priceOptions) + { + + $opt = []; + foreach ($overrideOptionsWithCriteria as $overrideOptionWithCriteria) { + + if (!self::hasPricingGroup($overrideOptionWithCriteria["key"], $priceOptions)) { + $opt[] = new PricingOptionGroup($overrideOptionWithCriteria["key"], $overrideOptionWithCriteria["optionDetail"], + isset($overrideOptionWithCriteria["attributeDescription"]) ? $overrideOptionWithCriteria["attributeDescription"] : null, + isset($overrideOptionWithCriteria["references"]) ? $overrideOptionWithCriteria["references"] : null); + + } + } + + return $opt; + } + /** * * @param FareBasis[] $pricingsFareBasis From 2eb848f2b794a67f7d11c567ed8d543875ef0ce0 Mon Sep 17 00:00:00 2001 From: Giovanni Griani Date: Mon, 22 Oct 2018 11:31:22 +0200 Subject: [PATCH 71/86] Tariffe etniche (LBR) --- src/Amadeus/Client/RequestOptions/Fare/MPPassenger.php | 4 ++-- .../Client/Struct/Fare/BaseMasterPricerMessage.php | 9 +++++++-- .../Client/Struct/Fare/MasterPricer/PaxReference.php | 8 +++++++- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/Amadeus/Client/RequestOptions/Fare/MPPassenger.php b/src/Amadeus/Client/RequestOptions/Fare/MPPassenger.php index 59b676902..2c77fd3fc 100644 --- a/src/Amadeus/Client/RequestOptions/Fare/MPPassenger.php +++ b/src/Amadeus/Client/RequestOptions/Fare/MPPassenger.php @@ -45,9 +45,9 @@ class MPPassenger extends LoadParamsFromArray /** * What type of passengers? self::TYPE_* * - * @var string + * @var Array */ - public $type; + public $type=[]; /** * If it's resident search* diff --git a/src/Amadeus/Client/Struct/Fare/BaseMasterPricerMessage.php b/src/Amadeus/Client/Struct/Fare/BaseMasterPricerMessage.php index 96fc5dc33..d8d159cba 100644 --- a/src/Amadeus/Client/Struct/Fare/BaseMasterPricerMessage.php +++ b/src/Amadeus/Client/Struct/Fare/BaseMasterPricerMessage.php @@ -63,8 +63,13 @@ class BaseMasterPricerMessage extends BaseWsMessage */ protected function loadPassenger($passenger, &$counter, &$infantCounter) { - $isInfant = ($passenger->type === 'INF'); - + if (!is_array($passenger->type)) + $isInfant = ($passenger->type === 'INF'); + else { + for ($i = 0; $i < count($passenger->type); $i++) { + $isInfant = ($passenger->type[$i] === 'INF' || $passenger->type[$i] === 'LIF' || $passenger->type[$i] === 'FNF'); + } + } $paxRef = new MasterPricer\PaxReference( $isInfant ? $infantCounter : $counter, $isInfant, diff --git a/src/Amadeus/Client/Struct/Fare/MasterPricer/PaxReference.php b/src/Amadeus/Client/Struct/Fare/MasterPricer/PaxReference.php index 7f339bd46..3472fe2b9 100644 --- a/src/Amadeus/Client/Struct/Fare/MasterPricer/PaxReference.php +++ b/src/Amadeus/Client/Struct/Fare/MasterPricer/PaxReference.php @@ -55,7 +55,13 @@ public function __construct($mainTravellerRef, $isInfant = false, $passengerType $this->ptc[] = 'STR'; $this->ptc[1] = $passengerType; } else { - $this->ptc[] = $passengerType; + if (!is_array($passengerType)) + $this->ptc[] = $passengerType; + else { + for ($i = 0; $i < count($passengerType); $i++) { + $this->ptc[$i] = $passengerType[$i]; + } + } } } } From cdc34af3bfb2bc8150539973b018dab7cf54675d Mon Sep 17 00:00:00 2001 From: Giovanni Griani Date: Wed, 31 Oct 2018 15:06:59 +0100 Subject: [PATCH 72/86] Ancillari --- src/Amadeus/Client.php | 19 ++++++++++++ src/Amadeus/Client/RequestCreator/Base.php | 3 +- .../Service/BookPriceProductConv.php | 19 ++++++++++++ .../ProfileCreateProfileOptions.php | 2 +- .../ServiceBookPriceProductOptions.php | 27 +++++++++++++++++ src/Amadeus/Client/Session/Handler/Base.php | 5 +++- .../Client/Session/Handler/SoapHeader4.php | 1 + .../Struct/Service/BookPriceProduct.php | 29 +++++++++++++++++++ 8 files changed, 102 insertions(+), 3 deletions(-) create mode 100644 src/Amadeus/Client/RequestCreator/Converter/Service/BookPriceProductConv.php create mode 100644 src/Amadeus/Client/RequestOptions/ServiceBookPriceProductOptions.php create mode 100644 src/Amadeus/Client/Struct/Service/BookPriceProduct.php diff --git a/src/Amadeus/Client.php b/src/Amadeus/Client.php index 295aab159..d4717b898 100644 --- a/src/Amadeus/Client.php +++ b/src/Amadeus/Client.php @@ -1811,4 +1811,23 @@ public function createTasf( return $this->callMessage($msgName, $options, $messageOptions); } + + /** + * Service_BookPriceProduct + * + * @param RequestOptions\ServiceBookPriceProductOptions $options + * @param array $messageOptions (OPTIONAL) + * @return Result + * @throws Client\InvalidMessageException + * @throws Client\RequestCreator\MessageVersionUnsupportedException + * @throws Exception + */ + public function serviceBookPriceProduct( + RequestOptions\ServiceBookPriceProductOptions $options, + $messageOptions = [] + ) + { + $msgName = 'Service_BookPriceProduct'; + return $this->callMessage($msgName, $options, $messageOptions); + } } diff --git a/src/Amadeus/Client/RequestCreator/Base.php b/src/Amadeus/Client/RequestCreator/Base.php index 344e08076..886863d5f 100644 --- a/src/Amadeus/Client/RequestCreator/Base.php +++ b/src/Amadeus/Client/RequestCreator/Base.php @@ -85,6 +85,7 @@ public function __construct(RequestCreatorParams $params) */ public function createRequest($messageName, RequestOptionsInterface $params) { + $this->checkMessageIsInWsdl($messageName); $builder = $this->findBuilderForMessage($messageName); @@ -149,6 +150,7 @@ protected function findBuilderForMessage($messageName) ) { $builder = $this->messageBuilders[$messageName]; } else { + $section = substr($messageName, 0, strpos($messageName, '_')); $message = substr($messageName, strpos($messageName, '_') + 1); @@ -157,7 +159,6 @@ protected function findBuilderForMessage($messageName) /** @var ConvertInterface $builder */ $builder = new $builderClass(); $builder->setParams($this->params); - $this->messageBuilders[$messageName] = $builder; } } diff --git a/src/Amadeus/Client/RequestCreator/Converter/Service/BookPriceProductConv.php b/src/Amadeus/Client/RequestCreator/Converter/Service/BookPriceProductConv.php new file mode 100644 index 000000000..5681fc407 --- /dev/null +++ b/src/Amadeus/Client/RequestCreator/Converter/Service/BookPriceProductConv.php @@ -0,0 +1,19 @@ + $propValue) { + if (property_exists($this, $propName)) { + $this->$propName = $propValue; + } + } + } +} \ No newline at end of file diff --git a/src/Amadeus/Client/Session/Handler/Base.php b/src/Amadeus/Client/Session/Handler/Base.php index e897ac7b5..58416fd2f 100644 --- a/src/Amadeus/Client/Session/Handler/Base.php +++ b/src/Amadeus/Client/Session/Handler/Base.php @@ -376,7 +376,9 @@ protected function getSoapClient($msgName) $wsdlId = $this->getWsdlIdFor($msgName); if (!empty($msgName)) { + if (!isset($this->soapClients[$wsdlId]) || !($this->soapClients[$wsdlId] instanceof \SoapClient)) { + $this->soapClients[$wsdlId] = $this->initSoapClient($wsdlId); } @@ -394,8 +396,9 @@ protected function getSoapClient($msgName) */ protected function initSoapClient($wsdlId) { + //print_r($wsdlId); $wsdlPath = WsdlAnalyser::$wsdlIds[$wsdlId]; - + //print_r($wsdlPath); $client = new Client\SoapClient( $wsdlPath, $this->makeSoapClientOptions(), diff --git a/src/Amadeus/Client/Session/Handler/SoapHeader4.php b/src/Amadeus/Client/Session/Handler/SoapHeader4.php index 5043c5852..56f8e4d8c 100644 --- a/src/Amadeus/Client/Session/Handler/SoapHeader4.php +++ b/src/Amadeus/Client/Session/Handler/SoapHeader4.php @@ -146,6 +146,7 @@ protected function prepareForNextMessage($messageName, $messageOptions) $headers = $this->createSoapHeaders($this->sessionData, $this->params, $messageName, $messageOptions); $this->getSoapClient($messageName)->__setSoapHeaders(null); + $this->getSoapClient($messageName)->__setSoapHeaders($headers); } diff --git a/src/Amadeus/Client/Struct/Service/BookPriceProduct.php b/src/Amadeus/Client/Struct/Service/BookPriceProduct.php new file mode 100644 index 000000000..80b579828 --- /dev/null +++ b/src/Amadeus/Client/Struct/Service/BookPriceProduct.php @@ -0,0 +1,29 @@ +Version = $options->Version; + $this->Recommendation = $options->Recommendation; + //$this->ServiceMiscellaneous = $options->ServiceMiscellaneous; + //$this->Products = $options->Products; + } + } +} \ No newline at end of file From de60ce270f34428fbc1a87830c0d6e587fb11b14 Mon Sep 17 00:00:00 2001 From: Giovanni Griani Date: Tue, 13 Nov 2018 12:18:15 +0100 Subject: [PATCH 73/86] Infant for tour operator tariff --- .../Struct/Fare/BaseMasterPricerMessage.php | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/Amadeus/Client/Struct/Fare/BaseMasterPricerMessage.php b/src/Amadeus/Client/Struct/Fare/BaseMasterPricerMessage.php index d8d159cba..e6e0d7f32 100644 --- a/src/Amadeus/Client/Struct/Fare/BaseMasterPricerMessage.php +++ b/src/Amadeus/Client/Struct/Fare/BaseMasterPricerMessage.php @@ -63,11 +63,22 @@ class BaseMasterPricerMessage extends BaseWsMessage */ protected function loadPassenger($passenger, &$counter, &$infantCounter) { - if (!is_array($passenger->type)) - $isInfant = ($passenger->type === 'INF'); - else { + if (!is_array($passenger->type)) { + switch ($passenger->type) { + case 'ITF': + case 'LIF': + case 'FNF': + case 'INF': + $isInfant = true; + break; + default: + $isInfant = false; + break; + } + //$isInfant = ($passenger->type === 'INF'); + } else { for ($i = 0; $i < count($passenger->type); $i++) { - $isInfant = ($passenger->type[$i] === 'INF' || $passenger->type[$i] === 'LIF' || $passenger->type[$i] === 'FNF'); + $isInfant = ($passenger->type[$i] === 'INF' || $passenger->type[$i] === 'LIF' || $passenger->type[$i] === 'FNF'|| $passenger->type[$i] === 'ITF'); } } $paxRef = new MasterPricer\PaxReference( From 459ee477a02f1d94d0ed2564c11cad6fc8ffe1fd Mon Sep 17 00:00:00 2001 From: Giovanni Griani Date: Wed, 14 Nov 2018 11:04:54 +0100 Subject: [PATCH 74/86] PNR_DeleteTSM --- src/Amadeus/Client.php | 19 ++++++++++++++ .../Converter/PNR/DeleteTSMConv.php | 21 ++++++++++++++++ .../RequestOptions/PnrDeleteTsmOptions.php | 25 +++++++++++++++++++ src/Amadeus/Client/Struct/Pnr/DeleteTsm.php | 22 ++++++++++++++++ 4 files changed, 87 insertions(+) create mode 100644 src/Amadeus/Client/RequestCreator/Converter/PNR/DeleteTSMConv.php create mode 100644 src/Amadeus/Client/RequestOptions/PnrDeleteTsmOptions.php create mode 100644 src/Amadeus/Client/Struct/Pnr/DeleteTsm.php diff --git a/src/Amadeus/Client.php b/src/Amadeus/Client.php index d4717b898..b62af5791 100644 --- a/src/Amadeus/Client.php +++ b/src/Amadeus/Client.php @@ -1830,4 +1830,23 @@ public function serviceBookPriceProduct( $msgName = 'Service_BookPriceProduct'; return $this->callMessage($msgName, $options, $messageOptions); } + + /** + * PNR_DeleteTSM + * + * @param RequestOptions\PnrDeleteTsmOptions $options + * @param array $messageOptions (OPTIONAL) + * @return Result + * @throws Client\InvalidMessageException + * @throws Client\RequestCreator\MessageVersionUnsupportedException + * @throws Exception + */ + public function deleteTsm( + RequestOptions\PnrDeleteTsmOptions $options, + $messageOptions = [] + ) + { + $msgName = 'PNR_DeleteTSM'; + return $this->callMessage($msgName, $options, $messageOptions); + } } diff --git a/src/Amadeus/Client/RequestCreator/Converter/PNR/DeleteTSMConv.php b/src/Amadeus/Client/RequestCreator/Converter/PNR/DeleteTSMConv.php new file mode 100644 index 000000000..f3b25cd0f --- /dev/null +++ b/src/Amadeus/Client/RequestCreator/Converter/PNR/DeleteTSMConv.php @@ -0,0 +1,21 @@ + $propValue) { + if (property_exists($this, $propName)) { + $this->$propName = $propValue; + } + } + } +} \ No newline at end of file diff --git a/src/Amadeus/Client/Struct/Pnr/DeleteTsm.php b/src/Amadeus/Client/Struct/Pnr/DeleteTsm.php new file mode 100644 index 000000000..ed8f26150 --- /dev/null +++ b/src/Amadeus/Client/Struct/Pnr/DeleteTsm.php @@ -0,0 +1,22 @@ +criteriaTattoo = $options->criteriaTattoo; + } + } +} \ No newline at end of file From 193e6aeefacad9e502aa3ac7cac843bcc36fbcdf Mon Sep 17 00:00:00 2001 From: Giovanni Griani Date: Mon, 26 Nov 2018 11:30:06 +0100 Subject: [PATCH 75/86] Implementazione Fare_GetFareFamilyDescription --- src/Amadeus/Client.php | 19 +++++++++++++++ .../Fare/GetFareFamilyDescriptionConv.php | 22 +++++++++++++++++ .../FareGetFareFamilyDescriptionOptions.php | 24 +++++++++++++++++++ .../Fare/GetFareFamilyDescriptionOptions.php | 23 ++++++++++++++++++ 4 files changed, 88 insertions(+) create mode 100644 src/Amadeus/Client/RequestCreator/Converter/Fare/GetFareFamilyDescriptionConv.php create mode 100644 src/Amadeus/Client/RequestOptions/FareGetFareFamilyDescriptionOptions.php create mode 100644 src/Amadeus/Client/Struct/Fare/GetFareFamilyDescriptionOptions.php diff --git a/src/Amadeus/Client.php b/src/Amadeus/Client.php index b62af5791..5672793ea 100644 --- a/src/Amadeus/Client.php +++ b/src/Amadeus/Client.php @@ -1849,4 +1849,23 @@ public function deleteTsm( $msgName = 'PNR_DeleteTSM'; return $this->callMessage($msgName, $options, $messageOptions); } + + /** + * Fare_GetFareFamilyDescription + * + * @param RequestOptions\PnrDeleteTsmOptions $options + * @param array $messageOptions (OPTIONAL) + * @return Result + * @throws Client\InvalidMessageException + * @throws Client\RequestCreator\MessageVersionUnsupportedException + * @throws Exception + */ + public function FareGetFareFamilyDescription( + RequestOptions\FareGetFareFamilyDescriptionOptions $options, + $messageOptions = [] + ) + { + $msgName = 'Fare_GetFareFamilyDescription'; + return $this->callMessage($msgName, $options, $messageOptions); + } } diff --git a/src/Amadeus/Client/RequestCreator/Converter/Fare/GetFareFamilyDescriptionConv.php b/src/Amadeus/Client/RequestCreator/Converter/Fare/GetFareFamilyDescriptionConv.php new file mode 100644 index 000000000..7a7cf2577 --- /dev/null +++ b/src/Amadeus/Client/RequestCreator/Converter/Fare/GetFareFamilyDescriptionConv.php @@ -0,0 +1,22 @@ + $propValue) { + if (property_exists($this, $propName)) { + $this->$propName = $propValue; + } + } + } +} \ No newline at end of file diff --git a/src/Amadeus/Client/Struct/Fare/GetFareFamilyDescriptionOptions.php b/src/Amadeus/Client/Struct/Fare/GetFareFamilyDescriptionOptions.php new file mode 100644 index 000000000..9b118a972 --- /dev/null +++ b/src/Amadeus/Client/Struct/Fare/GetFareFamilyDescriptionOptions.php @@ -0,0 +1,23 @@ +standaloneDescriptionRequest = $options->standaloneDescriptionRequest; + } + } +} \ No newline at end of file From 36390a45b2c28a4556421a1ddbf5623dcf66f474 Mon Sep 17 00:00:00 2001 From: Giovanni Griani Date: Wed, 5 Dec 2018 15:38:18 +0100 Subject: [PATCH 76/86] Virtual card --- src/Amadeus/Client.php | 17 +++++++++++++ .../PAY/GetVirtualCreditCardConv.php | 19 +++++++++++++++ .../PAYGetVirtualCreditCardOptions.php | 16 +++++++++++++ .../Struct/Pay/PAYGetVirtualCreditCard.php | 24 +++++++++++++++++++ 4 files changed, 76 insertions(+) create mode 100644 src/Amadeus/Client/RequestCreator/Converter/PAY/GetVirtualCreditCardConv.php create mode 100644 src/Amadeus/Client/RequestOptions/PAYGetVirtualCreditCardOptions.php create mode 100644 src/Amadeus/Client/Struct/Pay/PAYGetVirtualCreditCard.php diff --git a/src/Amadeus/Client.php b/src/Amadeus/Client.php index 5672793ea..afd9aa4e7 100644 --- a/src/Amadeus/Client.php +++ b/src/Amadeus/Client.php @@ -1868,4 +1868,21 @@ public function FareGetFareFamilyDescription( $msgName = 'Fare_GetFareFamilyDescription'; return $this->callMessage($msgName, $options, $messageOptions); } + + /** + * Fare_GetFareFamilyDescription + * + * @param RequestOptions\PAYGetVirtualCreditCardOptions $options + * @param array $messageOptions (OPTIONAL) + * @return Result + * @throws Client\InvalidMessageException + * @throws Client\RequestCreator\MessageVersionUnsupportedException + * @throws Exception + */ + public function PayGetVirtualCreditCard(RequestOptions\PAYGetVirtualCreditCardOptions $options, + $messageOptions = []) + { + $msgName = 'PAY_GetVirtualCreditCard'; + return $this->callMessage($msgName, $options, $messageOptions); + } } diff --git a/src/Amadeus/Client/RequestCreator/Converter/PAY/GetVirtualCreditCardConv.php b/src/Amadeus/Client/RequestCreator/Converter/PAY/GetVirtualCreditCardConv.php new file mode 100644 index 000000000..075df6cbb --- /dev/null +++ b/src/Amadeus/Client/RequestCreator/Converter/PAY/GetVirtualCreditCardConv.php @@ -0,0 +1,19 @@ +transactionContext = $requestOptions->transactionContext; + $this->paymentAndPnrContext = $requestOptions->paymentAndPnrContext; + } + } +} \ No newline at end of file From 884f89c9b2658c14bf385730523f968c88b2e8ea Mon Sep 17 00:00:00 2001 From: Giovanni Griani Date: Tue, 8 Jan 2019 09:29:54 +0100 Subject: [PATCH 77/86] commit --- src/Amadeus/Client/SoapClient.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Amadeus/Client/SoapClient.php b/src/Amadeus/Client/SoapClient.php index 7528c62e7..98b9b0f18 100644 --- a/src/Amadeus/Client/SoapClient.php +++ b/src/Amadeus/Client/SoapClient.php @@ -40,6 +40,7 @@ class SoapClient extends \SoapClient implements Log\LoggerAwareInterface { use Log\LoggerAwareTrait; + const REMOVE_EMPTY_XSLT_LOCATION = 'SoapClient/removeempty.xslt'; /** From f9bb82b0c7ec2d3d177284773f1033e726d08b69 Mon Sep 17 00:00:00 2001 From: Giovanni Griani Date: Wed, 6 Mar 2019 11:01:01 +0100 Subject: [PATCH 78/86] Hotel --- src/Amadeus/Client.php | 32 ++++++++ src/Amadeus/Client/RequestCreator/Base.php | 1 + .../Converter/Hotel/DescriptiveInfoConv.php | 20 +++++ .../Converter/Hotel/EnhancedPricingConv.php | 20 +++++ .../Hotel/MultiSingleAvail/Criteria.php | 4 + .../Hotel/MultiSingleAvail/Guest.php | 2 + .../Hotel/MultiSingleAvail/Segment.php | 2 + .../HotelDescriptiveInfoOptions.php | 19 +++++ .../HotelEnhancedPricingOptions.php | 23 ++++++ .../HotelMultiSingleAvailOptions.php | 2 + .../RequestOptions/HotelSellOptions.php | 2 + src/Amadeus/Client/ResponseHandler/Base.php | 1 - .../ResponseHandler/Hotel/HandlerSell.php | 5 +- .../StandardResponseHandler.php | 81 ++++++++++--------- src/Amadeus/Client/SoapClient.php | 21 +++-- .../Struct/Hotel/HotelDescriptiveInfo.php | 30 +++++++ .../Struct/Hotel/HotelEnhancedPricing.php | 37 +++++++++ .../Struct/Hotel/MultiSingleAvailability.php | 3 + .../AvailRequestSegment.php | 2 + .../MultiSingleAvailability/Criterion.php | 8 +- .../MultiSingleAvailability/GuestCount.php | 1 + .../HotelSearchCriterionType.php | 1 + src/Amadeus/Client/Struct/Hotel/Sell.php | 1 + 23 files changed, 268 insertions(+), 50 deletions(-) create mode 100644 src/Amadeus/Client/RequestCreator/Converter/Hotel/DescriptiveInfoConv.php create mode 100644 src/Amadeus/Client/RequestCreator/Converter/Hotel/EnhancedPricingConv.php create mode 100644 src/Amadeus/Client/RequestOptions/HotelDescriptiveInfoOptions.php create mode 100644 src/Amadeus/Client/RequestOptions/HotelEnhancedPricingOptions.php create mode 100644 src/Amadeus/Client/Struct/Hotel/HotelDescriptiveInfo.php create mode 100644 src/Amadeus/Client/Struct/Hotel/HotelEnhancedPricing.php diff --git a/src/Amadeus/Client.php b/src/Amadeus/Client.php index 2729dffd3..9d853e3de 100644 --- a/src/Amadeus/Client.php +++ b/src/Amadeus/Client.php @@ -1552,6 +1552,38 @@ public function hotelSell(RequestOptions\HotelSellOptions $options, $messageOpti return $this->callMessage($msgName, $options, $messageOptions); } + /** + * Hotel_DescriptiveInfo + * + * @param RequestOptions\HotelDescriptiveInfoOptions $options + * @param array $messageOptions (OPTIONAL) + * @return Result + */ + public function hotelDescriptionInfo( + RequestOptions\HotelDescriptiveInfoOptions $options, + $messageOptions = [] + ) { + $msgName = 'Hotel_DescriptiveInfo'; + + return $this->callMessage($msgName, $options, $messageOptions); + } + + /** + * Hotel_EnhancedPricing + * + * @param RequestOptions\HotelEnhancedPricingOptions $options + * @param array $messageOptions (OPTIONAL) + * @return Result + */ + public function hotelEnhancedPricing( + RequestOptions\HotelEnhancedPricingOptions $options, + $messageOptions = [] + ) { + $msgName = 'Hotel_EnhancedPricing'; + + return $this->callMessage($msgName, $options, $messageOptions); + } + /** * PriceXplorer_ExtremeSearch * diff --git a/src/Amadeus/Client/RequestCreator/Base.php b/src/Amadeus/Client/RequestCreator/Base.php index 886863d5f..0f2eefbca 100644 --- a/src/Amadeus/Client/RequestCreator/Base.php +++ b/src/Amadeus/Client/RequestCreator/Base.php @@ -155,6 +155,7 @@ protected function findBuilderForMessage($messageName) $message = substr($messageName, strpos($messageName, '_') + 1); $builderClass = __NAMESPACE__.'\\Converter\\'.$section.'\\'.$message."Conv"; + //print_r($builderClass); if (class_exists($builderClass)) { /** @var ConvertInterface $builder */ $builder = new $builderClass(); diff --git a/src/Amadeus/Client/RequestCreator/Converter/Hotel/DescriptiveInfoConv.php b/src/Amadeus/Client/RequestCreator/Converter/Hotel/DescriptiveInfoConv.php new file mode 100644 index 000000000..45ee621a9 --- /dev/null +++ b/src/Amadeus/Client/RequestCreator/Converter/Hotel/DescriptiveInfoConv.php @@ -0,0 +1,20 @@ +findHandlerForMessage($messageName); - if ($handler instanceof MessageResponseHandler) { return $handler->analyze($sendResult); } else { diff --git a/src/Amadeus/Client/ResponseHandler/Hotel/HandlerSell.php b/src/Amadeus/Client/ResponseHandler/Hotel/HandlerSell.php index 0cb2fbdbb..f13c31447 100644 --- a/src/Amadeus/Client/ResponseHandler/Hotel/HandlerSell.php +++ b/src/Amadeus/Client/ResponseHandler/Hotel/HandlerSell.php @@ -34,12 +34,15 @@ */ class HandlerSell 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) { - //TODO + return $this->analyzeSimpleResponseErrorCodeAndMessage($response); } } diff --git a/src/Amadeus/Client/ResponseHandler/StandardResponseHandler.php b/src/Amadeus/Client/ResponseHandler/StandardResponseHandler.php index fe2d85683..cf2d9ffaa 100644 --- a/src/Amadeus/Client/ResponseHandler/StandardResponseHandler.php +++ b/src/Amadeus/Client/ResponseHandler/StandardResponseHandler.php @@ -37,9 +37,7 @@ 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. And it's short. - * - * If you disagree, 1v1 me at the sun. In highsec, limited engagement. I don't want you blobbing me. + * Why not "m"? It's as good as any other letter. */ const XMLNS_PREFIX = "m"; @@ -130,37 +128,21 @@ protected function analyzeWithErrorCodeMsgQueryLevel(SendResult $response, $qErr } /** -<<<<<<< HEAD * Analyse with XPATH queries for error code and message, provide fixed category -======= - * 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 ->>>>>>> hotel * * @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) -<<<<<<< HEAD * @param string $category Result::STATUS_* The fixed error category (status) * @return Result */ public function analyzeWithErrCodeAndMsgQueryFixedCat(SendResult $response, $qErr, $qMsg, $category) -======= - * @param string $qSrc XPATH query for fetching error source (first node is used) - * @return Result - */ - protected function analyzeWithErrorCodeMsgQuerySource(SendResult $response, $qErr, $qMsg, $qSrc) ->>>>>>> hotel { $analyzeResponse = new Result($response); $domXpath = $this->makeDomXpath($response->responseXml); $errorCodeNodeList = $domXpath->query($qErr); -<<<<<<< HEAD $errorMsgNodeList = $domXpath->query($qMsg); if ($errorCodeNodeList->length > 0 || $errorMsgNodeList->length > 0) { @@ -171,26 +153,6 @@ protected function analyzeWithErrorCodeMsgQuerySource(SendResult $response, $qEr $analyzeResponse->messages[] = new Result\NotOk( $errorCode, $this->makeMessageFromMessagesNodeList($errorMsgNodeList) -======= - - 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 ->>>>>>> hotel ); } @@ -360,4 +322,45 @@ function ($item) { ) ); } + + protected function analyzeWithErrorCodeMsgQuerySource(SendResult $response, $qErr, $qMsg, $qSrc) + { + $analyzeResponse = new Result($response); + + $domXpath = $this->makeDomXpath($response->responseXml); + $errorCodeNodeList = $domXpath->query($qErr); + // print_r(); + $errorMsgNodeList = $domXpath->query($qMsg); + + if ($errorCodeNodeList->length > 0 || $errorMsgNodeList->length > 0) { + $analyzeResponse->status = $analyzeResponse->status; + + $errorCode = ($errorCodeNodeList->length > 0) ? $errorCodeNodeList->item(0)->nodeValue : null; + + $analyzeResponse->messages[] = new Result\NotOk( + $errorCode, + $this->makeMessageFromMessagesNodeList($errorMsgNodeList)); + } + 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; + } } diff --git a/src/Amadeus/Client/SoapClient.php b/src/Amadeus/Client/SoapClient.php index 98b9b0f18..f0f357577 100644 --- a/src/Amadeus/Client/SoapClient.php +++ b/src/Amadeus/Client/SoapClient.php @@ -92,9 +92,9 @@ protected function transformIncomingRequest($request) { $newRequest = null; - $xsltFile = dirname(__FILE__).DIRECTORY_SEPARATOR.self::REMOVE_EMPTY_XSLT_LOCATION; + $xsltFile = dirname(__FILE__) . DIRECTORY_SEPARATOR . self::REMOVE_EMPTY_XSLT_LOCATION; if (!is_readable($xsltFile)) { - throw new Exception('XSLT file "'.$xsltFile.'" is not readable!'); + throw new Exception('XSLT file "' . $xsltFile . '" is not readable!'); } $dom = new \DOMDocument('1.0', 'UTF-8'); @@ -110,20 +110,29 @@ protected function transformIncomingRequest($request) //On transform error: usually when modifying the XSLT transformation incorrectly... $this->logger->log( Log\LogLevel::ERROR, - __METHOD__."__doRequest(): XSLTProcessor::transformToXml " + __METHOD__ . "__doRequest(): XSLTProcessor::transformToXml " . "returned FALSE: could not perform transformation!!" ); $newRequest = $request; } else { $newDom = new \DOMDocument('1.0', 'UTF-8'); $newDom->preserveWhiteSpace = false; + $transform = self::transformstring($transform); $newDom->loadXML($transform); - $newRequest = $newDom->saveXML(); } - unset($processor, $xslt, $dom, $transform); - + //print_r($newRequest); return $newRequest; } + + private function transformstring($transform) + { + $retVal = $transform; + $retVal = str_replace("ns1:", "", $transform); + $retVal = str_replace("http://webservices.amadeus.com/Hotel_DescriptiveInfo_7.1", "http://webservices.amadeus.com/OTA_HotelDescriptiveInfoRQ_07.1_1A2007A", $retVal); + $retVal = str_replace("", "", $retVal); + //print_r($retVal); + return $retVal; + } } diff --git a/src/Amadeus/Client/Struct/Hotel/HotelDescriptiveInfo.php b/src/Amadeus/Client/Struct/Hotel/HotelDescriptiveInfo.php new file mode 100644 index 000000000..e33e44177 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/HotelDescriptiveInfo.php @@ -0,0 +1,30 @@ +HotelDescriptiveInfos = $options->HotelDescriptiveInfos; + $this->EchoToken = $options->EchoToken; + $this->Version = $options->Version; + $this->PrimaryLangID = $options->PrimaryLangID; + $this->xmlns = $options->xmlns; + } +} \ No newline at end of file diff --git a/src/Amadeus/Client/Struct/Hotel/HotelEnhancedPricing.php b/src/Amadeus/Client/Struct/Hotel/HotelEnhancedPricing.php new file mode 100644 index 000000000..656014499 --- /dev/null +++ b/src/Amadeus/Client/Struct/Hotel/HotelEnhancedPricing.php @@ -0,0 +1,37 @@ +xsi = $options->xsi; + $this->EchoToken = $options->EchoToken; +// $this->SummaryOnly = $options->SummaryOnly; +// $this->AvailRatesOnly = $options->AvailRatesOnly; + $this->PrimaryLangID = $options->PrimaryLangID; +// $this->RateRangeOnly = $options->RateRangeOnly; +// $this->RequestedCurrency = $options->RequestedCurrency; + $this->Version = $options->Version; + $this->AvailRequestSegments = $options->AvailRequestSegments; + } +} \ No newline at end of file diff --git a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability.php b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability.php index 487b91728..e4f4a8024 100644 --- a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability.php +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability.php @@ -112,6 +112,8 @@ class MultiSingleAvailability extends BaseWsMessage */ public $SearchCacheLevel; + public $xmlns; + /** * MultiSingleAvailability constructor. * @@ -139,6 +141,7 @@ protected function loadAttributes($options) $this->SortOrder = $options->sortOrder; $this->MaxResponses = $options->maxResponses; $this->SearchCacheLevel = $options->searchCacheLevel; + $this->xmlns = $options->xmlns; } /** diff --git a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/AvailRequestSegment.php b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/AvailRequestSegment.php index c5ad2f848..6686142d6 100644 --- a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/AvailRequestSegment.php +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/AvailRequestSegment.php @@ -44,6 +44,7 @@ class AvailRequestSegment public $MoreDataEchoToken; + /** * AvailRequestSegment constructor. * @@ -53,6 +54,7 @@ public function __construct($segment = null) { if ($segment instanceof Segment) { $this->InfoSource = $segment->infoSource; + $this->HotelSearchCriteria = new HotelSearchCriteria( $segment->criteria, $segment->bestOnly, diff --git a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Criterion.php b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Criterion.php index c631fe691..fcba427f9 100644 --- a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Criterion.php +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/Criterion.php @@ -51,12 +51,14 @@ class Criterion extends HotelSearchCriterionType public function __construct(Criteria $criterion) { $this->ExactMatch = $criterion->exactMatch; - + $this->Radius = $criterion->Radius; + if(isset($criterion->Position)) + $this->Position=$criterion->Position; foreach ($criterion->hotelReferences as $hotelReference) { $this->HotelRef[] = new HotelRef($hotelReference); } - - $this->StayDateRange = new StayDateRange($criterion->stayStart, $criterion->stayEnd); + if (isset($criterion->stayStart)) + $this->StayDateRange = new StayDateRange($criterion->stayStart, $criterion->stayEnd); foreach ($criterion->rates as $rate) { $this->RateRange[] = new RateRange($rate); diff --git a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/GuestCount.php b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/GuestCount.php index 594d6fe63..cd7cd4b35 100644 --- a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/GuestCount.php +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/GuestCount.php @@ -51,5 +51,6 @@ public function __construct(Guest $guest) { $this->AgeQualifyingCode = $guest->occupantCode; $this->Count = $guest->amount; + $this->Age = $guest->Age; } } diff --git a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/HotelSearchCriterionType.php b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/HotelSearchCriterionType.php index 591cc4599..a6309e36a 100644 --- a/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/HotelSearchCriterionType.php +++ b/src/Amadeus/Client/Struct/Hotel/MultiSingleAvailability/HotelSearchCriterionType.php @@ -139,6 +139,7 @@ class HotelSearchCriterionType public $CodeRef; + /** * @var HotelRef[] */ diff --git a/src/Amadeus/Client/Struct/Hotel/Sell.php b/src/Amadeus/Client/Struct/Hotel/Sell.php index 1a7b167c4..db130bbb6 100644 --- a/src/Amadeus/Client/Struct/Hotel/Sell.php +++ b/src/Amadeus/Client/Struct/Hotel/Sell.php @@ -95,5 +95,6 @@ class Sell extends BaseWsMessage public function __construct(HotelSellOptions $options) { //TODO + $this->roomStayData = $options->roomStayData; } } From fa1d5e828bafabdac50bc5600efaba3c239d376a Mon Sep 17 00:00:00 2001 From: Giovanni Griani Date: Thu, 28 Mar 2019 11:57:26 +0100 Subject: [PATCH 79/86] Anchored search MPT --- src/Amadeus/Client/RequestOptions/Fare/MPItinerary.php | 4 ++++ .../Client/Struct/Fare/MasterPricerTravelBoardSearch.php | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/src/Amadeus/Client/RequestOptions/Fare/MPItinerary.php b/src/Amadeus/Client/RequestOptions/Fare/MPItinerary.php index 945591995..79a51d977 100644 --- a/src/Amadeus/Client/RequestOptions/Fare/MPItinerary.php +++ b/src/Amadeus/Client/RequestOptions/Fare/MPItinerary.php @@ -160,4 +160,8 @@ class MPItinerary extends LoadParamsFromArray * @var string */ public $cabinOption; + + public $flightInfoPNR; + public $requestedSegmentAction; + } diff --git a/src/Amadeus/Client/Struct/Fare/MasterPricerTravelBoardSearch.php b/src/Amadeus/Client/Struct/Fare/MasterPricerTravelBoardSearch.php index d982b2b5a..720cc34ee 100644 --- a/src/Amadeus/Client/Struct/Fare/MasterPricerTravelBoardSearch.php +++ b/src/Amadeus/Client/Struct/Fare/MasterPricerTravelBoardSearch.php @@ -209,6 +209,12 @@ protected function loadItinerary($opt, &$counter) $tmpItinerary = new MasterPricer\Itinerary($segmentRef); + if (!empty($opt->flightInfoPNR)) { + $tmpItinerary->flightInfoPNR = $opt->flightInfoPNR; + } + if (!empty($opt->requestedSegmentAction)) { + $tmpItinerary->requestedSegmentAction = $opt->requestedSegmentAction; + } $tmpItinerary->departureLocalization = new MasterPricer\DepartureLocalization( $opt->departureLocation ); From acaac37a306000707f178c596896a0ba81231c73 Mon Sep 17 00:00:00 2001 From: Giovanni Griani Date: Wed, 17 Apr 2019 16:18:26 +0200 Subject: [PATCH 80/86] Emissione tariffa con nego e servizi ancillari --- .../DocIssuanceIssueCombinedOptions.php | 2 + .../DocIssuanceIssueMiscDocOptions.php | 183 +++++++++--------- src/Amadeus/Client/SoapClient.php | 10 +- .../Struct/DocIssuance/IssueCombined.php | 8 + .../IssueMiscellaneousDocuments.php | 31 +-- 5 files changed, 129 insertions(+), 105 deletions(-) diff --git a/src/Amadeus/Client/RequestOptions/DocIssuanceIssueCombinedOptions.php b/src/Amadeus/Client/RequestOptions/DocIssuanceIssueCombinedOptions.php index 0df59cf8e..4796a3f2a 100644 --- a/src/Amadeus/Client/RequestOptions/DocIssuanceIssueCombinedOptions.php +++ b/src/Amadeus/Client/RequestOptions/DocIssuanceIssueCombinedOptions.php @@ -38,4 +38,6 @@ class DocIssuanceIssueCombinedOptions extends DocIssuanceIssueTicketOptions * @var int[] */ public $tsmTattoos = []; + + public $emds=[]; } diff --git a/src/Amadeus/Client/RequestOptions/DocIssuanceIssueMiscDocOptions.php b/src/Amadeus/Client/RequestOptions/DocIssuanceIssueMiscDocOptions.php index f8983a1e2..b43183355 100644 --- a/src/Amadeus/Client/RequestOptions/DocIssuanceIssueMiscDocOptions.php +++ b/src/Amadeus/Client/RequestOptions/DocIssuanceIssueMiscDocOptions.php @@ -32,34 +32,36 @@ */ class DocIssuanceIssueMiscDocOptions extends Base { - const PAX_TYPE_ADULT = 'A'; - const PAX_TYPE_INFANT = 'IN'; - - const OPTION_TEMPLATE_DISPLAY = 'TMD'; - const OPTION_TEMPLATE_OVERRIDE = 'TMO'; - const OPTION_EMD_ISSUANCE = 'ED'; - const OPTION_RETRIEVE_PNR = 'RT'; - const OPTION_BASIC_INVOICE = 'INV'; - const OPTION_BASIC_JOINT_INVOICE_ALL_PAX = 'IVJ'; - const OPTION_EXTENDED_INVOICE = 'INE'; - const OPTION_EXTENDED_INVOICE_ALL_PAX = 'INJ'; - const OPTION_CONCEALED_CREDIT_CARD = 'CCC'; - const OPTION_CREDIT_CARD_OVERRIDE = 'CCO'; - const OPTION_DOCUMENT_RECEIPT = 'TRP'; - const OPTION_ELECTRONIC_TICKETING_TCH = 'TKP'; - const OPTION_GROUP_ISSUANCE = 'GRP'; - const OPTION_PRINT_EXTENDED_ITINERARY = 'IEP'; - const OPTION_ITINERARY_RECEIPT = 'ITR'; - const OPTION_HOTEL_TERMS = 'HT'; - const OPTION_INHIBIT_CCCF_COUPON_PRINT = 'ICP'; - const OPTION_NO_CREDIT = 'NCC'; - const OPTION_OVERRIDE_NON_EXCHANGEABLE_IND = 'ONX'; - const OPTION_OVERRIDE_NAME_CHECK = 'ONC'; - const OPTION_PAPER_OVERRIDE = 'PT'; - const OPTION_FORCE_PASSENGER_RECEIPT = 'CR'; - const OPTION_PAYMENT_ON_DEMAND = 'POD'; - const OPTION_PRE_ISSUE_VALIDATION = 'TKT'; - const OPTION_PRESENT_CREDIT_CARD = 'PCC'; + public $selection; + public $optionGroup; +// const PAX_TYPE_ADULT = 'A'; +// const PAX_TYPE_INFANT = 'IN'; +// +// const OPTION_TEMPLATE_DISPLAY = 'TMD'; +// const OPTION_TEMPLATE_OVERRIDE = 'TMO'; +// const OPTION_EMD_ISSUANCE = 'ED'; +// const OPTION_RETRIEVE_PNR = 'RT'; +// const OPTION_BASIC_INVOICE = 'INV'; +// const OPTION_BASIC_JOINT_INVOICE_ALL_PAX = 'IVJ'; +// const OPTION_EXTENDED_INVOICE = 'INE'; +// const OPTION_EXTENDED_INVOICE_ALL_PAX = 'INJ'; +// const OPTION_CONCEALED_CREDIT_CARD = 'CCC'; +// const OPTION_CREDIT_CARD_OVERRIDE = 'CCO'; +// const OPTION_DOCUMENT_RECEIPT = 'TRP'; +// const OPTION_ELECTRONIC_TICKETING_TCH = 'TKP'; +// const OPTION_GROUP_ISSUANCE = 'GRP'; +// const OPTION_PRINT_EXTENDED_ITINERARY = 'IEP'; +// const OPTION_ITINERARY_RECEIPT = 'ITR'; +// const OPTION_HOTEL_TERMS = 'HT'; +// const OPTION_INHIBIT_CCCF_COUPON_PRINT = 'ICP'; +// const OPTION_NO_CREDIT = 'NCC'; +// const OPTION_OVERRIDE_NON_EXCHANGEABLE_IND = 'ONX'; +// const OPTION_OVERRIDE_NAME_CHECK = 'ONC'; +// const OPTION_PAPER_OVERRIDE = 'PT'; +// const OPTION_FORCE_PASSENGER_RECEIPT = 'CR'; +// const OPTION_PAYMENT_ON_DEMAND = 'POD'; +// const OPTION_PRE_ISSUE_VALIDATION = 'TKT'; +// const OPTION_PRESENT_CREDIT_CARD = 'PCC'; /** * The Ticket Issuance options to be triggered @@ -103,63 +105,70 @@ class DocIssuanceIssueMiscDocOptions extends Base * * @var string[] */ - public $options = []; - - /** - * The list of TSM numbers to be ticketed - * - * @var int[] - */ - public $tsmNumbers = []; - - /** - * The list of TSM tattoos to be ticketed - * - * @var int[] - */ - public $tsmTattoos = []; - - /** - * Line Number Selection - * - * @var int[] - */ - public $lineNumbers = []; - - /** - * Passenger numbers to be ticketed - * - * @var int[] - */ - public $passengerNumbers = []; - - /** - * Tattoos of passengers to be ticketed - * - * @var int[] - */ - public $passengerTattoos = []; - - /** - * PAX Passenger Type Selection - * - * self::PAX_TYPE_* - * - * @var string - */ - public $passengerType; - - /** - * Stock Reference - * - * @var string - */ - public $stockReference; - - /** - * Compound Options - * - * @var CompoundOption[] - */ - public $compoundOptions = []; +// public $options = []; +// +// /** +// * The list of TSM numbers to be ticketed +// * +// * @var int[] +// */ +// public $tsmNumbers = []; +// +// /** +// * The list of TSM tattoos to be ticketed +// * +// * @var int[] +// */ +// public $tsmTattoos = []; +// +// /** +// * Line Number Selection +// * +// * @var int[] +// */ +// public $lineNumbers = []; +// +// /** +// * Passenger numbers to be ticketed +// * +// * @var int[] +// */ +// public $passengerNumbers = []; +// +// /** +// * Tattoos of passengers to be ticketed +// * +// * @var int[] +// */ +// public $passengerTattoos = []; +// +// /** +// * PAX Passenger Type Selection +// * +// * self::PAX_TYPE_* +// * +// * @var string +// */ +// public $passengerType; +// +// /** +// * Stock Reference +// * +// * @var string +// */ +// public $stockReference; +// +// /** +// * Compound Options +// * +// * @var CompoundOption[] +// */ +// public $compoundOptions = []; +// +// /** +// * The list of Emd tattoos to be ticketed +// * +// * @var int[] +// */ +// public $emdTattoos = []; } diff --git a/src/Amadeus/Client/SoapClient.php b/src/Amadeus/Client/SoapClient.php index f0f357577..300a4cdb1 100644 --- a/src/Amadeus/Client/SoapClient.php +++ b/src/Amadeus/Client/SoapClient.php @@ -79,7 +79,7 @@ public function __doRequest($request, $location, $action, $version, $oneWay = nu } $newRequest = $this->transformIncomingRequest($request); - + //print_r($newRequest); return parent::__doRequest($newRequest, $location, $action, $version, $oneWay); } @@ -117,7 +117,7 @@ protected function transformIncomingRequest($request) } else { $newDom = new \DOMDocument('1.0', 'UTF-8'); $newDom->preserveWhiteSpace = false; - $transform = self::transformstring($transform); + //$transform = self::transformstring($transform); $newDom->loadXML($transform); $newRequest = $newDom->saveXML(); } @@ -130,9 +130,9 @@ private function transformstring($transform) { $retVal = $transform; $retVal = str_replace("ns1:", "", $transform); - $retVal = str_replace("http://webservices.amadeus.com/Hotel_DescriptiveInfo_7.1", "http://webservices.amadeus.com/OTA_HotelDescriptiveInfoRQ_07.1_1A2007A", $retVal); - $retVal = str_replace("", "", $retVal); - //print_r($retVal); + //$retVal = str_replace("http://webservices.amadeus.com/Hotel_DescriptiveInfo_7.1", "http://webservices.amadeus.com/OTA_HotelDescriptiveInfoRQ_07.1_1A2007A", $retVal); + //$retVal = str_replace("https://nodeD1.test.webservices.amadeus.com/1ASIWLERLERU", "https://pilotd.test.webservices.amadeus.com/1ASIWLERLERU", $retVal); + //$retVal = str_replace("", "", $retVal); return $retVal; } } diff --git a/src/Amadeus/Client/Struct/DocIssuance/IssueCombined.php b/src/Amadeus/Client/Struct/DocIssuance/IssueCombined.php index cc8a743ea..4f6b342a3 100644 --- a/src/Amadeus/Client/Struct/DocIssuance/IssueCombined.php +++ b/src/Amadeus/Client/Struct/DocIssuance/IssueCombined.php @@ -48,5 +48,13 @@ public function __construct(DocIssuanceIssueCombinedOptions $options) ) ); } + foreach ($options->emds as $emd) { + $this->addSelectionItem( + new ReferenceDetails( + $emd, + ReferenceDetails::TYPE_TSM + ) + ); + } } } diff --git a/src/Amadeus/Client/Struct/DocIssuance/IssueMiscellaneousDocuments.php b/src/Amadeus/Client/Struct/DocIssuance/IssueMiscellaneousDocuments.php index 8704a193e..bd7e60410 100644 --- a/src/Amadeus/Client/Struct/DocIssuance/IssueMiscellaneousDocuments.php +++ b/src/Amadeus/Client/Struct/DocIssuance/IssueMiscellaneousDocuments.php @@ -23,33 +23,38 @@ namespace Amadeus\Client\Struct\DocIssuance; use Amadeus\Client\RequestOptions\DocIssuanceIssueMiscDocOptions; - +use Amadeus\Client\Struct\BaseWsMessage; /** * DocIssuance_IssueMiscellaneousDocuments request structure * * @package Amadeus\Client\Struct\DocIssuance * @author Dieter Devlieghere */ -class IssueMiscellaneousDocuments extends DocIssuanceBaseMsg +class IssueMiscellaneousDocuments extends BaseWsMessage { /** * IssueMiscellaneousDocuments constructor. * * @param DocIssuanceIssueMiscDocOptions $options */ + public $selection; + public $optionGroup; public function __construct(DocIssuanceIssueMiscDocOptions $options) { - $this->addSelectionItems($options->tsmNumbers, ReferenceDetails::TYPE_TSM); - $this->addSelectionItems($options->tsmTattoos, ReferenceDetails::TYPE_TSM_TATTOO); - $this->addSelectionItems($options->lineNumbers, ReferenceDetails::TYPE_LINE_NUMBER); - - $this->loadOptions($options->options, $options->compoundOptions); - - $this->loadReferences($options); - - $this->loadPassType($options->passengerType); - - $this->loadStockReference($options->stockReference); +// $this->addSelectionItems($options->tsmNumbers, ReferenceDetails::TYPE_TSM); +// $this->addSelectionItems($options->tsmTattoos, ReferenceDetails::TYPE_TSM_TATTOO); +// $this->addSelectionItems($options->lineNumbers, ReferenceDetails::TYPE_LINE_NUMBER); +// $this->addSelectionItems($options->emdTattoos, ReferenceDetails::TYPE_TSM); +// +// $this->loadOptions($options->options, $options->compoundOptions); +// +// $this->loadReferences($options); +// +// $this->loadPassType($options->passengerType); +// +// $this->loadStockReference($options->stockReference); + $this->selection = $options->selection; + $this->optionGroup = $options->optionGroup; } /** From ce2a6e0c6d5a6a2b1bffe8f84e1c4ba30537f694 Mon Sep 17 00:00:00 2001 From: Giovanni Griani Date: Mon, 6 May 2019 15:13:49 +0200 Subject: [PATCH 81/86] Emissione con infant a 0 --- .../Client/RequestOptions/Pnr/Element/FormOfPayment.php | 2 ++ .../Struct/Pnr/AddMultiElements/DataElementsIndiv.php | 8 ++++++++ .../Client/Struct/Pnr/AddMultiElements/FopExtension.php | 7 +++++-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/Amadeus/Client/RequestOptions/Pnr/Element/FormOfPayment.php b/src/Amadeus/Client/RequestOptions/Pnr/Element/FormOfPayment.php index 690433833..16ef5f96b 100644 --- a/src/Amadeus/Client/RequestOptions/Pnr/Element/FormOfPayment.php +++ b/src/Amadeus/Client/RequestOptions/Pnr/Element/FormOfPayment.php @@ -109,4 +109,6 @@ class FormOfPayment extends Element * @var bool */ public $isServiceFee = false; + + public $fopExtension; } diff --git a/src/Amadeus/Client/Struct/Pnr/AddMultiElements/DataElementsIndiv.php b/src/Amadeus/Client/Struct/Pnr/AddMultiElements/DataElementsIndiv.php index e489a14c2..3061ab278 100644 --- a/src/Amadeus/Client/Struct/Pnr/AddMultiElements/DataElementsIndiv.php +++ b/src/Amadeus/Client/Struct/Pnr/AddMultiElements/DataElementsIndiv.php @@ -190,6 +190,14 @@ protected function loadElement($element, $elementType) $this->formOfPayment->fop->freetext = $element->freeText; } elseif ($element->type === Fop::IDENT_MISC && $element->freeText === "NONREF") { $this->fopExtension[] = new FopExtension(1); + }elseif($element->type === Fop::IDENT_CASH && $element->fopExtension === "INF") { + $this->fopExtension[] = new FopExtension( + 1, + null, + null, + 'INF' + + ); } elseif ($element->type === Fop::IDENT_CHECK) { throw new \RuntimeException("FOP CHECK NOT YET IMPLEMENTED"); } diff --git a/src/Amadeus/Client/Struct/Pnr/AddMultiElements/FopExtension.php b/src/Amadeus/Client/Struct/Pnr/AddMultiElements/FopExtension.php index c823da8a6..6a09bf931 100644 --- a/src/Amadeus/Client/Struct/Pnr/AddMultiElements/FopExtension.php +++ b/src/Amadeus/Client/Struct/Pnr/AddMultiElements/FopExtension.php @@ -60,12 +60,15 @@ class FopExtension extends WsMessageUtility * @param string|null $cvcCode * @param string|null $holderName */ - public function __construct($fopSequenceNumber, $cvcCode = null, $holderName = null) + public function __construct($fopSequenceNumber, $cvcCode = null, $holderName = null, $passengerType = null) { if (is_numeric($fopSequenceNumber)) { - $this->fopSequenceNumber = (int) $fopSequenceNumber; + $this->fopSequenceNumber = (int)$fopSequenceNumber; } + if ($this->checkAnyNotEmpty($passengerType)) { + $this->passengerType=$passengerType; + } if ($this->checkAnyNotEmpty($cvcCode, $holderName)) { $this->newFopsDetails = new NewFopsDetails(); $this->newFopsDetails->cvData = $cvcCode; From 6cb837178f589d45bc28d22cff938d62c9e75c39 Mon Sep 17 00:00:00 2001 From: Giovanni Griani Date: Wed, 5 Jun 2019 09:56:56 +0200 Subject: [PATCH 82/86] Ggiunto il tag 'orderClassesByCabin' nella multiavailibility --- .../Client/Struct/Air/MultiAvailability/CabinOption.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Amadeus/Client/Struct/Air/MultiAvailability/CabinOption.php b/src/Amadeus/Client/Struct/Air/MultiAvailability/CabinOption.php index 9ea106e6f..3d56d536e 100644 --- a/src/Amadeus/Client/Struct/Air/MultiAvailability/CabinOption.php +++ b/src/Amadeus/Client/Struct/Air/MultiAvailability/CabinOption.php @@ -32,6 +32,9 @@ class CabinOption */ public function __construct($cabinCode) { - $this->cabinDesignation = new CabinDesignation($cabinCode); + if ($cabinCode != '702') + $this->cabinDesignation = new CabinDesignation($cabinCode); + else + $this->orderClassesByCabin = $cabinCode; } } From f8852cd9310ee29e31c4ca43e158ba8c88538bdc Mon Sep 17 00:00:00 2001 From: Giovanni Griani Date: Wed, 10 Jul 2019 09:57:56 +0200 Subject: [PATCH 83/86] ATC --- .../RequestOptions/DocIssuanceIssueCombinedOptions.php | 2 ++ src/Amadeus/Client/Struct/DocIssuance/IssueCombined.php | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/src/Amadeus/Client/RequestOptions/DocIssuanceIssueCombinedOptions.php b/src/Amadeus/Client/RequestOptions/DocIssuanceIssueCombinedOptions.php index 4796a3f2a..60290afa5 100644 --- a/src/Amadeus/Client/RequestOptions/DocIssuanceIssueCombinedOptions.php +++ b/src/Amadeus/Client/RequestOptions/DocIssuanceIssueCombinedOptions.php @@ -40,4 +40,6 @@ class DocIssuanceIssueCombinedOptions extends DocIssuanceIssueTicketOptions public $tsmTattoos = []; public $emds=[]; + + public $svcs=[]; } diff --git a/src/Amadeus/Client/Struct/DocIssuance/IssueCombined.php b/src/Amadeus/Client/Struct/DocIssuance/IssueCombined.php index 4f6b342a3..50c109daa 100644 --- a/src/Amadeus/Client/Struct/DocIssuance/IssueCombined.php +++ b/src/Amadeus/Client/Struct/DocIssuance/IssueCombined.php @@ -56,5 +56,13 @@ public function __construct(DocIssuanceIssueCombinedOptions $options) ) ); } + foreach ($options->svcs as $svc) { + $this->addSelectionItem( + new ReferenceDetails( + $svc, + ReferenceDetails::TYPE_LINE_NUMBER + ) + ); + } } } From d1c33383f926e920501009fab03e92b796167685 Mon Sep 17 00:00:00 2001 From: Giovanni Griani Date: Wed, 10 Jul 2019 09:58:23 +0200 Subject: [PATCH 84/86] ATC --- .../DocIssuanceIssueCombinedOptions.php | 4 ++++ .../DocIssuanceIssueMiscDocOptions.php | 4 ++-- .../Client/RequestOptions/Fop/MopInfo.php | 2 +- .../Client/Struct/DocIssuance/IssueCombined.php | 16 ++++++++++++++++ .../DocIssuance/IssueMiscellaneousDocuments.php | 2 ++ 5 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/Amadeus/Client/RequestOptions/DocIssuanceIssueCombinedOptions.php b/src/Amadeus/Client/RequestOptions/DocIssuanceIssueCombinedOptions.php index 60290afa5..dd828754a 100644 --- a/src/Amadeus/Client/RequestOptions/DocIssuanceIssueCombinedOptions.php +++ b/src/Amadeus/Client/RequestOptions/DocIssuanceIssueCombinedOptions.php @@ -42,4 +42,8 @@ class DocIssuanceIssueCombinedOptions extends DocIssuanceIssueTicketOptions public $emds=[]; public $svcs=[]; + + public $cup=[]; + + public $segs=[]; } diff --git a/src/Amadeus/Client/RequestOptions/DocIssuanceIssueMiscDocOptions.php b/src/Amadeus/Client/RequestOptions/DocIssuanceIssueMiscDocOptions.php index b43183355..f8aacd99f 100644 --- a/src/Amadeus/Client/RequestOptions/DocIssuanceIssueMiscDocOptions.php +++ b/src/Amadeus/Client/RequestOptions/DocIssuanceIssueMiscDocOptions.php @@ -39,7 +39,7 @@ class DocIssuanceIssueMiscDocOptions extends Base // // const OPTION_TEMPLATE_DISPLAY = 'TMD'; // const OPTION_TEMPLATE_OVERRIDE = 'TMO'; -// const OPTION_EMD_ISSUANCE = 'ED'; + const OPTION_EMD_ISSUANCE = 'ED'; // const OPTION_RETRIEVE_PNR = 'RT'; // const OPTION_BASIC_INVOICE = 'INV'; // const OPTION_BASIC_JOINT_INVOICE_ALL_PAX = 'IVJ'; @@ -105,7 +105,7 @@ class DocIssuanceIssueMiscDocOptions extends Base * * @var string[] */ -// public $options = []; + public $options = []; // // /** // * The list of TSM numbers to be ticketed diff --git a/src/Amadeus/Client/RequestOptions/Fop/MopInfo.php b/src/Amadeus/Client/RequestOptions/Fop/MopInfo.php index 164fc9d0e..2976cecdd 100644 --- a/src/Amadeus/Client/RequestOptions/Fop/MopInfo.php +++ b/src/Amadeus/Client/RequestOptions/Fop/MopInfo.php @@ -35,7 +35,7 @@ class MopInfo extends LoadParamsFromArray const STATUS_NEW = "N"; const STATUS_OLD = "O"; - const ENCODING_MUTUAL = "ZZZ"; + const ENCODING_MUTUAL = "1"; const FOPTYPE_AUTHORIZATION_ONLY = "AO"; const FOPTYPE_FC_ELEMENT = "FC"; diff --git a/src/Amadeus/Client/Struct/DocIssuance/IssueCombined.php b/src/Amadeus/Client/Struct/DocIssuance/IssueCombined.php index 50c109daa..9c556fc06 100644 --- a/src/Amadeus/Client/Struct/DocIssuance/IssueCombined.php +++ b/src/Amadeus/Client/Struct/DocIssuance/IssueCombined.php @@ -64,5 +64,21 @@ public function __construct(DocIssuanceIssueCombinedOptions $options) ) ); } + foreach ($options->cup as $cup) { + $this->addSelectionItem( + new ReferenceDetails( + $cup, + ReferenceDetails::TYPE_COUPON_NUMBER + ) + ); + } + foreach ($options->segs as $seg) { + $this->addSelectionItem( + new ReferenceDetails( + $seg, + ReferenceDetails::TYPE_SEGMENT_TATTOO + ) + ); + } } } diff --git a/src/Amadeus/Client/Struct/DocIssuance/IssueMiscellaneousDocuments.php b/src/Amadeus/Client/Struct/DocIssuance/IssueMiscellaneousDocuments.php index bd7e60410..efbf7eb23 100644 --- a/src/Amadeus/Client/Struct/DocIssuance/IssueMiscellaneousDocuments.php +++ b/src/Amadeus/Client/Struct/DocIssuance/IssueMiscellaneousDocuments.php @@ -39,6 +39,7 @@ class IssueMiscellaneousDocuments extends BaseWsMessage */ public $selection; public $optionGroup; + public $options = []; public function __construct(DocIssuanceIssueMiscDocOptions $options) { // $this->addSelectionItems($options->tsmNumbers, ReferenceDetails::TYPE_TSM); @@ -55,6 +56,7 @@ public function __construct(DocIssuanceIssueMiscDocOptions $options) // $this->loadStockReference($options->stockReference); $this->selection = $options->selection; $this->optionGroup = $options->optionGroup; + $this->options = $options->options; } /** From b363dec1570683b027e824888f19bfac77e92a76 Mon Sep 17 00:00:00 2001 From: Giovanni Griani Date: Thu, 11 Jul 2019 18:17:45 +0200 Subject: [PATCH 85/86] Tariffe residenti --- .../Struct/Fare/InformativePricing13/PassengersGroup.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Amadeus/Client/Struct/Fare/InformativePricing13/PassengersGroup.php b/src/Amadeus/Client/Struct/Fare/InformativePricing13/PassengersGroup.php index 480e082a8..0ab7ff652 100644 --- a/src/Amadeus/Client/Struct/Fare/InformativePricing13/PassengersGroup.php +++ b/src/Amadeus/Client/Struct/Fare/InformativePricing13/PassengersGroup.php @@ -62,8 +62,10 @@ public function __construct($passenger, $group) $this->travellersID = new TravellersId(); - foreach ($passenger->tattoos as $tattoo) { - $this->travellersID->travellerDetails[] = new TravellerDetails($tattoo); + if (is_array($passenger->tattoos) || is_object($passenger->tattoos)) { + foreach ($passenger->tattoos as $tattoo) { + $this->travellersID->travellerDetails[] = new TravellerDetails($tattoo); + } } if (!empty($passenger->type)) { From 33d1ec398d1735a22a98637c314ecc9ba69248a2 Mon Sep 17 00:00:00 2001 From: Giovanni Griani Date: Tue, 13 Aug 2019 12:25:11 +0200 Subject: [PATCH 86/86] Refund --- src/Amadeus/Client/RequestOptions/TicketProcessEDocOptions.php | 2 +- src/Amadeus/Client/Struct/Ticket/ProcessEDoc.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Amadeus/Client/RequestOptions/TicketProcessEDocOptions.php b/src/Amadeus/Client/RequestOptions/TicketProcessEDocOptions.php index 9c69f029a..8561471c4 100644 --- a/src/Amadeus/Client/RequestOptions/TicketProcessEDocOptions.php +++ b/src/Amadeus/Client/RequestOptions/TicketProcessEDocOptions.php @@ -53,7 +53,7 @@ class TicketProcessEDocOptions extends Base * * @var string */ - public $ticketNumber; + public $ticketNumber=[]; /** diff --git a/src/Amadeus/Client/Struct/Ticket/ProcessEDoc.php b/src/Amadeus/Client/Struct/Ticket/ProcessEDoc.php index b61e1755c..fddc85dca 100644 --- a/src/Amadeus/Client/Struct/Ticket/ProcessEDoc.php +++ b/src/Amadeus/Client/Struct/Ticket/ProcessEDoc.php @@ -97,7 +97,8 @@ public function __construct(TicketProcessEDocOptions $options) protected function loadOptions($ticketNumber) { if (!empty($ticketNumber)) { - $this->infoGroup[] = new InfoGroup($ticketNumber); + for ($i = 0; $i < count($ticketNumber); $i++) + $this->infoGroup[] = new InfoGroup($ticketNumber[$i]); } }