diff --git a/CHANGELOG.md b/CHANGELOG.md index 37791349e..09621d9bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Release 1.3.0 (UNRELEASED) * Added support for Multiple Office ID's in ``Fare_MasterPricerTravelBoardSearch`` (https://github.com/amabnl/amadeus-ws-client/pull/44) - Michal Hernas * Implemented ``Ticket_CheckEligibility`` message for ATC Shopper flow (https://github.com/amabnl/amadeus-ws-client/issues/39) +* Implemented ``Ticket_ATCShopperMasterPricerTravelBoardSearch`` message for ATC Shopper flow (https://github.com/amabnl/amadeus-ws-client/issues/39) * Implemented ``Ticket_CreateTSMFareElement`` message for ATC Shopper flow (https://github.com/amabnl/amadeus-ws-client/issues/39) # Release 1.2.0 (23 February 2017) diff --git a/docs/list-of-supported-messages.rst b/docs/list-of-supported-messages.rst index a79c0b50d..e0218538b 100644 --- a/docs/list-of-supported-messages.rst +++ b/docs/list-of-supported-messages.rst @@ -41,6 +41,7 @@ This is the list of messages that are at least partially supported at this time: - Ticket_DeleteTSMP - Ticket_DisplayTSMFareElement - Ticket_CheckEligibility +- Ticket_ATCShopperMasterPricerTravelBoardSearch - DocIssuance_IssueTicket - DocIssuance_IssueMiscellaneousDocuments - DocIssuance_IssueCombined @@ -74,7 +75,6 @@ These messages will be implemented at some point in the future. *Pull requests a - Air_RebookAirSegment - Air_TLAGetAvailability - PointOfRef_CategoryList -- Ticket_ATCShopperMasterPricerTravelBoardSearch - Ticket_RepricePNRWithBookingClass - Ticket_ReissueConfirmedPricing - Ticket_ProcessEDoc diff --git a/docs/samples.rst b/docs/samples.rst index a5358d98d..0138a32b5 100644 --- a/docs/samples.rst +++ b/docs/samples.rst @@ -1339,7 +1339,7 @@ Delete the form of payment from the TSM of tattoo 18: $createTsmResponse = $client->ticketCreateTSMFareElement( new TicketCreateTsmFareElOptions([ - 'elementType' => TicketCreateTsmFareElOptions::TYPE_FORM_OF_PAYMENT, + 'type' => TicketCreateTsmFareElOptions::TYPE_FORM_OF_PAYMENT, 'tattoo' => 18, 'info' => '#####' ]) @@ -1354,7 +1354,7 @@ Set the form of payment Check to the TSM of tattoo 18: $createTsmResponse = $client->ticketCreateTSMFareElement( new TicketCreateTsmFareElOptions([ - 'elementType' => TicketCreateTsmFareElOptions::TYPE_FORM_OF_PAYMENT, + 'type' => TicketCreateTsmFareElOptions::TYPE_FORM_OF_PAYMENT, 'tattoo' => 18, 'info' => 'CHECK/EUR304.89' ]) @@ -1521,6 +1521,80 @@ Ticket eligibility request for one Adult passenger with ticket number 172-230000 ]) ); +---------------------------------------------- +Ticket_ATCShopperMasterPricerTravelBoardSearch +---------------------------------------------- + +Basic Search With Mandatory Elements: + +.. code-block:: php + + use Amadeus\Client\RequestOptions\TicketAtcShopperMpTbSearchOptions; + use Amadeus\Client\RequestOptions\Fare\MPDate; + use Amadeus\Client\RequestOptions\Fare\MPItinerary; + use Amadeus\Client\RequestOptions\Fare\MPLocation; + use Amadeus\Client\RequestOptions\Fare\MPPassenger; + use Amadeus\Client\RequestOptions\Ticket\ReqSegOptions; + + $response = $client->ticketAtcShopperMasterPricerTravelBoardSearch( + new TicketAtcShopperMpTbSearchOptions([ + 'nrOfRequestedPassengers' => 2, + 'nrOfRequestedResults' => 2, + 'passengers' => [ + new MPPassenger([ + 'type' => MPPassenger::TYPE_ADULT, + 'count' => 1 + ]), + new MPPassenger([ + 'type' => MPPassenger::TYPE_CHILD, + 'count' => 1 + ]) + ], + 'flightOptions' => [ + TicketAtcShopperMpTbSearchOptions::FLIGHTOPT_PUBLISHED, + TicketAtcShopperMpTbSearchOptions::FLIGHTOPT_UNIFARES + ], + 'itinerary' => [ + new MPItinerary([ + 'segmentReference' => 1, + 'departureLocation' => new MPLocation(['city' => 'MAD']), + 'arrivalLocation' => new MPLocation(['city' => 'LHR']), + 'date' => new MPDate([ + 'date' => new \DateTime('2013-08-12T00:00:00+0000', new \DateTimeZone('UTC')) + ]) + ]), + new MPItinerary([ + 'segmentReference' => 2, + 'departureLocation' => new MPLocation(['city' => 'LHR']), + 'arrivalLocation' => new MPLocation(['city' => 'MAD']), + 'date' => new MPDate([ + 'date' => new \DateTime('2013-12-12T00:00:00+0000', new \DateTimeZone('UTC')) + ]) + ]) + ], + 'ticketNumbers' => [ + '0572187777498', + '0572187777499' + ], + 'requestedSegments' => [ + new ReqSegOptions([ + 'requestCode' => ReqSegOptions::REQUEST_CODE_KEEP_FLIGHTS_AND_FARES, + 'connectionLocations' => [ + 'MAD', + 'LHR' + ] + ]), + new ReqSegOptions([ + 'requestCode' => ReqSegOptions::REQUEST_CODE_CHANGE_REQUESTED_SEGMENT, + 'connectionLocations' => [ + 'LHR', + 'MAD' + ] + ]) + ] + ]) + ); + *********** DocIssuance diff --git a/src/Amadeus/Client.php b/src/Amadeus/Client.php index e15ef508a..068dea1c5 100644 --- a/src/Amadeus/Client.php +++ b/src/Amadeus/Client.php @@ -918,6 +918,22 @@ public function ticketCheckEligibility( return $this->callMessage($msgName, $options, $messageOptions); } + /** + * Ticket_ATCShopperMasterPricerTravelBoardSearch + * + * @param RequestOptions\TicketAtcShopperMpTbSearchOptions $options + * @param array $messageOptions (OPTIONAL) + * @return Result + */ + public function ticketAtcShopperMasterPricerTravelBoardSearch( + RequestOptions\TicketAtcShopperMpTbSearchOptions $options, + $messageOptions = [] + ) { + $msgName = 'Ticket_ATCShopperMasterPricerTravelBoardSearch'; + + return $this->callMessage($msgName, $options, $messageOptions); + } + /** * DocIssuance_IssueTicket * diff --git a/src/Amadeus/Client/RequestCreator/Converter/Ticket/ATCShopperMasterPricerTravelBoardSearchConv.php b/src/Amadeus/Client/RequestCreator/Converter/Ticket/ATCShopperMasterPricerTravelBoardSearchConv.php new file mode 100644 index 000000000..16434126d --- /dev/null +++ b/src/Amadeus/Client/RequestCreator/Converter/Ticket/ATCShopperMasterPricerTravelBoardSearchConv.php @@ -0,0 +1,46 @@ + + */ +class ATCShopperMasterPricerTravelBoardSearchConv extends BaseConverter +{ + /** + * @param TicketAtcShopperMpTbSearchOptions $requestOptions + * @param int|string $version + * @return Struct\Ticket\AtcShopperMasterPricerTravelBoardSearch + */ + public function convert($requestOptions, $version) + { + return new Struct\Ticket\AtcShopperMasterPricerTravelBoardSearch($requestOptions); + } +} diff --git a/src/Amadeus/Client/RequestOptions/Fare/MPItinerary.php b/src/Amadeus/Client/RequestOptions/Fare/MPItinerary.php index 717cd16b1..1b71ed36d 100644 --- a/src/Amadeus/Client/RequestOptions/Fare/MPItinerary.php +++ b/src/Amadeus/Client/RequestOptions/Fare/MPItinerary.php @@ -33,10 +33,22 @@ class MPItinerary extends LoadParamsFromArray { /** + * Segment Reference (optional) + * + * @var int + */ + public $segmentReference; + + /** + * Departure location + * * @var MPLocation */ public $departureLocation; + /** + * Arrival location + * * @var MPLocation */ public $arrivalLocation; diff --git a/src/Amadeus/Client/RequestOptions/Pnr/Element/Commission.php b/src/Amadeus/Client/RequestOptions/Pnr/Element/Commission.php new file mode 100644 index 000000000..1e961ff35 --- /dev/null +++ b/src/Amadeus/Client/RequestOptions/Pnr/Element/Commission.php @@ -0,0 +1,60 @@ + + */ +class Commission extends Element +{ + const PAXTYPE_INFANT_WITHOUT_SEAT = 766; + const PAXTYPE_INFANT_WITH_SEAT = 767; + const PAXTYPE_CABIN_BAGGAGE = "C"; + const PAXTYPE_EXTRA_SEAT = "E"; + const PAXTYPE_GROUP = "G"; + const PAXTYPE_INFANT_NOT_OCCUPYING_A_SEAT = "INF"; + const PAXTYPE_MONTH = "MTH"; + const PAXTYPE_PASSENGER = "PAX"; + const PAXTYPE_YEAR = "YRS"; + + const INDICATOR_COMMISSION = "FM"; + + /** + * Passenger type + * + * Choose from self::PAXTYPE_* + * + * @var string|int + */ + public $passengerType; + + /** + * @var string + */ + public $indicator; +} diff --git a/src/Amadeus/Client/RequestOptions/Ticket/ReqSegOptions.php b/src/Amadeus/Client/RequestOptions/Ticket/ReqSegOptions.php new file mode 100644 index 000000000..99d301017 --- /dev/null +++ b/src/Amadeus/Client/RequestOptions/Ticket/ReqSegOptions.php @@ -0,0 +1,57 @@ + + */ +class ReqSegOptions extends LoadParamsFromArray +{ + const REQUEST_CODE_ADD = "A"; + const REQUEST_CODE_CHANGE_REQUESTED_SEGMENT = "C"; + const REQUEST_CODE_IGNORE_ONEWAYCOMBINEABLE = "I"; + const REQUEST_CODE_KEEP_FLIGHTS = "K"; + const REQUEST_CODE_KEEP_FLIGHTS_AND_FARES = "KF"; + const REQUEST_CODE_IGNORE_OTHER = "O"; + const REQUEST_CODE_REMOVE = "R"; + + /** + * What action to perform + * + * choose from self::REQUEST_CODE_* + * + * @var string + */ + public $requestCode; + + /** + * @var string[] + */ + public $connectionLocations = []; +} diff --git a/src/Amadeus/Client/RequestOptions/TicketAtcShopperMpTbSearchOptions.php b/src/Amadeus/Client/RequestOptions/TicketAtcShopperMpTbSearchOptions.php new file mode 100644 index 000000000..762075b80 --- /dev/null +++ b/src/Amadeus/Client/RequestOptions/TicketAtcShopperMpTbSearchOptions.php @@ -0,0 +1,48 @@ + + */ +class TicketAtcShopperMpTbSearchOptions extends FareMasterPricerTbSearch +{ + /** + * List of ticket numbers to change + * + * @var string[] + */ + public $ticketNumbers = []; + + /** + * Changed ticket requested segments. + * + * @var ReqSegOptions[] + */ + public $requestedSegments = []; +} diff --git a/src/Amadeus/Client/RequestOptions/TicketCreateTsmFareElOptions.php b/src/Amadeus/Client/RequestOptions/TicketCreateTsmFareElOptions.php index 9f2c120bc..10f74d99f 100644 --- a/src/Amadeus/Client/RequestOptions/TicketCreateTsmFareElOptions.php +++ b/src/Amadeus/Client/RequestOptions/TicketCreateTsmFareElOptions.php @@ -28,31 +28,8 @@ * @package Amadeus\Client\RequestOptions * @author Dieter Devlieghere */ -class TicketCreateTsmFareElOptions extends Base +class TicketCreateTsmFareElOptions extends TicketDisplayTsmFareElOptions { - const TYPE_FARE_DISCOUNT = "FD"; - const TYPE_ENDORSEMENT = "FE"; - const TYPE_COMMISSION = "FM"; - const TYPE_ORIGINAL_EXCHANGE_DOCUMENT = "FO"; - const TYPE_FORM_OF_PAYMENT = "FP"; - const TYPE_TOUR_CODE = "FT"; - const TYPE_MISCELLANEOUS_INFORMATION_1 = "FZ1"; - const TYPE_MISCELLANEOUS_INFORMATION_2 = "FZ2"; - - /** - * Type of the Fare element of the associated TSM. - * - * @var string - */ - public $elementType; - - /** - * The tattoo of the associated TSM. - * - * @var int - */ - public $tattoo; - /** * Unstructured fare element information * diff --git a/src/Amadeus/Client/RequestOptions/TicketDisplayTsmFareElOptions.php b/src/Amadeus/Client/RequestOptions/TicketDisplayTsmFareElOptions.php index 318bdd51a..513b0eca4 100644 --- a/src/Amadeus/Client/RequestOptions/TicketDisplayTsmFareElOptions.php +++ b/src/Amadeus/Client/RequestOptions/TicketDisplayTsmFareElOptions.php @@ -41,14 +41,14 @@ class TicketDisplayTsmFareElOptions extends Base const TYPE_ALL_FARE_ELEMENTS = "ALL"; /** - * Tattoo number of the TSM-P to get fare elements for. + * The tattoo of the associated TSM. * * @var int */ public $tattoo; /** - * What kind of fare elements to display. + * Type of the Fare element of the associated TSM. * * self::TYPE_* * diff --git a/src/Amadeus/Client/ResponseHandler/FOP/HandlerCreateFormOfPayment.php b/src/Amadeus/Client/ResponseHandler/FOP/HandlerCreateFormOfPayment.php index fe6871682..1ac4ec72d 100644 --- a/src/Amadeus/Client/ResponseHandler/FOP/HandlerCreateFormOfPayment.php +++ b/src/Amadeus/Client/ResponseHandler/FOP/HandlerCreateFormOfPayment.php @@ -61,7 +61,6 @@ class HandlerCreateFormOfPayment extends StandardResponseHandler */ public function analyze(SendResult $response) { - //TODO $analyzeResponse = new Result($response); $domXpath = $this->makeDomXpath($response->responseXml); diff --git a/src/Amadeus/Client/ResponseHandler/Ticket/HandlerATCShopperMasterPricerTravelBoardSearch.php b/src/Amadeus/Client/ResponseHandler/Ticket/HandlerATCShopperMasterPricerTravelBoardSearch.php new file mode 100644 index 000000000..1b4202573 --- /dev/null +++ b/src/Amadeus/Client/ResponseHandler/Ticket/HandlerATCShopperMasterPricerTravelBoardSearch.php @@ -0,0 +1,36 @@ + + */ +class HandlerATCShopperMasterPricerTravelBoardSearch extends HandlerMasterPricerTravelBoardSearch +{ + +} diff --git a/src/Amadeus/Client/Struct/Fare/MasterPricerTravelBoardSearch.php b/src/Amadeus/Client/Struct/Fare/MasterPricerTravelBoardSearch.php index 95e96a9eb..bdc4483bb 100644 --- a/src/Amadeus/Client/Struct/Fare/MasterPricerTravelBoardSearch.php +++ b/src/Amadeus/Client/Struct/Fare/MasterPricerTravelBoardSearch.php @@ -26,11 +26,14 @@ use Amadeus\Client\RequestOptions\Fare\MPItinerary; use Amadeus\Client\RequestOptions\FareMasterPricerCalendarOptions; use Amadeus\Client\RequestOptions\FareMasterPricerTbSearch; +use Amadeus\Client\RequestOptions\TicketAtcShopperMpTbSearchOptions; use Amadeus\Client\Struct\Fare\MasterPricer; /** * Fare_MasterPricerTravelBoardSearch message structure * + * Also used for Fare_MasterPricerCalendar and Ticket_ATCShopperMasterPricerTravelBoardSearch + * * @package Amadeus\Client\Struct\Fare * @author Dieter Devlieghere */ @@ -106,17 +109,17 @@ class MasterPricerTravelBoardSearch extends BaseMasterPricerMessage /** * MasterPricerTravelBoardSearch constructor. * - * @param FareMasterPricerTbSearch|FareMasterPricerCalendarOptions|null $options + * @param FareMasterPricerTbSearch|FareMasterPricerCalendarOptions|TicketAtcShopperMpTbSearchOptions|null $options */ public function __construct($options = null) { - if ($options instanceof FareMasterPricerTbSearch || $options instanceof FareMasterPricerCalendarOptions) { + if ($options instanceof FareMasterPricerTbSearch) { $this->loadOptions($options); } } /** - * @param FareMasterPricerTbSearch|FareMasterPricerCalendarOptions $options + * @param FareMasterPricerTbSearch|FareMasterPricerCalendarOptions|TicketAtcShopperMpTbSearchOptions $options */ protected function loadOptions($options) { @@ -177,7 +180,13 @@ protected function loadOfficeId($officeId) */ protected function loadItinerary($itineraryOptions, &$counter) { - $tmpItinerary = new MasterPricer\Itinerary($counter); + $segmentRef = $counter; + + if (!empty($itineraryOptions->segmentReference)) { + $segmentRef = $itineraryOptions->segmentReference; + } + + $tmpItinerary = new MasterPricer\Itinerary($segmentRef); $tmpItinerary->departureLocalization = new MasterPricer\DepartureLocalization( $itineraryOptions->departureLocation diff --git a/src/Amadeus/Client/Struct/Ticket/AtcShopperMasterPricerTravelBoardSearch.php b/src/Amadeus/Client/Struct/Ticket/AtcShopperMasterPricerTravelBoardSearch.php new file mode 100644 index 000000000..eee90ed2c --- /dev/null +++ b/src/Amadeus/Client/Struct/Ticket/AtcShopperMasterPricerTravelBoardSearch.php @@ -0,0 +1,64 @@ + + */ +class AtcShopperMasterPricerTravelBoardSearch extends MasterPricerTravelBoardSearch +{ + /** + * @var TicketChangeInfo + */ + public $ticketChangeInfo; + + /** + * AtcShopperMasterPricerTravelBoardSearch constructor. + * @param TicketAtcShopperMpTbSearchOptions|null $options + */ + public function __construct($options) + { + parent::__construct($options); + + $this->loadTicketChangeInfo($options->ticketNumbers, $options->requestedSegments); + } + + /** + * @param string[] $ticketNumbers + * @param ReqSegOptions[] $requestedSegments + */ + protected function loadTicketChangeInfo($ticketNumbers, $requestedSegments) + { + if (!empty($ticketNumbers)) { + $this->ticketChangeInfo = new TicketChangeInfo($ticketNumbers, $requestedSegments); + } + } +} diff --git a/src/Amadeus/Client/Struct/Ticket/CheckEligibility/ActionIdentification.php b/src/Amadeus/Client/Struct/Ticket/CheckEligibility/ActionIdentification.php new file mode 100644 index 000000000..3cda97d42 --- /dev/null +++ b/src/Amadeus/Client/Struct/Ticket/CheckEligibility/ActionIdentification.php @@ -0,0 +1,62 @@ + + */ +class ActionIdentification +{ + const REQ_ADD = "A"; + const REQ_CHANGE_REQUESTED_SEGMENT = "C"; + const REQ_IGNORE_ONEWAYCOMBINEABLE = "I"; + const REQ_KEEP_FLIGHTS = "K"; + const REQ_KEEP_FLIGHTS_AND_FARES = "KF"; + const REQ_IGNORE_OTHER = "O"; + const REQ_REMOVE = "R"; + + /** + * self::REQ_* + * + * @var string + */ + public $actionRequestCode; + + /** + * @var ProductDetails + */ + public $productDetails; + + /** + * ActionIdentification constructor. + * + * @param string $actionRequestCode self::REQ_* + */ + public function __construct($actionRequestCode) + { + $this->actionRequestCode = $actionRequestCode; + } +} diff --git a/src/Amadeus/Client/Struct/Ticket/CheckEligibility/ConnectPointDetails.php b/src/Amadeus/Client/Struct/Ticket/CheckEligibility/ConnectPointDetails.php new file mode 100644 index 000000000..e53be09fb --- /dev/null +++ b/src/Amadeus/Client/Struct/Ticket/CheckEligibility/ConnectPointDetails.php @@ -0,0 +1,49 @@ + + */ +class ConnectPointDetails +{ + /** + * @var ConnectionDetails[] + */ + public $connectionDetails = []; + + /** + * ConnectPointDetails constructor. + * + * @param string[] $connectionDetails + */ + public function __construct(array $connectionDetails) + { + foreach ($connectionDetails as $connectionDetail) { + $this->connectionDetails[] = new ConnectionDetails($connectionDetail); + } + } +} diff --git a/src/Amadeus/Client/Struct/Ticket/CheckEligibility/ConnectionDetails.php b/src/Amadeus/Client/Struct/Ticket/CheckEligibility/ConnectionDetails.php new file mode 100644 index 000000000..8288422f8 --- /dev/null +++ b/src/Amadeus/Client/Struct/Ticket/CheckEligibility/ConnectionDetails.php @@ -0,0 +1,47 @@ + + */ +class ConnectionDetails +{ + /** + * @var string + */ + public $location; + + /** + * ConnectionDetails constructor. + * + * @param string $location + */ + public function __construct($location) + { + $this->location = $location; + } +} diff --git a/src/Amadeus/Client/Struct/Ticket/CheckEligibility/ProductDetails.php b/src/Amadeus/Client/Struct/Ticket/CheckEligibility/ProductDetails.php new file mode 100644 index 000000000..958ce89a3 --- /dev/null +++ b/src/Amadeus/Client/Struct/Ticket/CheckEligibility/ProductDetails.php @@ -0,0 +1,52 @@ + + */ +class ProductDetails +{ + /** + * @var mixed + */ + public $flightNumber; + + /** + * @var mixed + */ + public $bookingClass; + + /** + * @var mixed + */ + public $operationalSuffix; + + /** + * @var mixed + */ + public $modifier; +} diff --git a/src/Amadeus/Client/Struct/Ticket/CheckEligibility/TicketChangeInfo.php b/src/Amadeus/Client/Struct/Ticket/CheckEligibility/TicketChangeInfo.php index 0ac0b009b..ea4067878 100644 --- a/src/Amadeus/Client/Struct/Ticket/CheckEligibility/TicketChangeInfo.php +++ b/src/Amadeus/Client/Struct/Ticket/CheckEligibility/TicketChangeInfo.php @@ -22,6 +22,8 @@ namespace Amadeus\Client\Struct\Ticket\CheckEligibility; +use Amadeus\Client\RequestOptions\Ticket\ReqSegOptions; + /** * TicketChangeInfo * @@ -44,9 +46,19 @@ class TicketChangeInfo * TicketChangeInfo constructor. * * @param string[] $ticketNumbers + * @param ReqSegOptions[]|null $requestedSegments */ - public function __construct(array $ticketNumbers) + public function __construct(array $ticketNumbers, $requestedSegments = null) { $this->ticketNumberDetails = new TicketNumberDetails($ticketNumbers); + + if (!empty($requestedSegments)) { + foreach ($requestedSegments as $requestedSegment) { + $this->ticketRequestedSegments[] = new TicketRequestedSegments( + $requestedSegment->requestCode, + $requestedSegment->connectionLocations + ); + } + } } } diff --git a/src/Amadeus/Client/Struct/Ticket/CheckEligibility/TicketRequestedSegments.php b/src/Amadeus/Client/Struct/Ticket/CheckEligibility/TicketRequestedSegments.php index 4bec76b64..6faa2a522 100644 --- a/src/Amadeus/Client/Struct/Ticket/CheckEligibility/TicketRequestedSegments.php +++ b/src/Amadeus/Client/Struct/Ticket/CheckEligibility/TicketRequestedSegments.php @@ -30,4 +30,25 @@ */ class TicketRequestedSegments { + /** + * @var ActionIdentification + */ + public $actionIdentification; + + /** + * @var ConnectPointDetails + */ + public $connectPointDetails; + + /** + * TicketRequestedSegments constructor. + * + * @param string $actionRequestCode ActionIdentification::REQ_* + * @param string[] $connectionLocations + */ + public function __construct($actionRequestCode, $connectionLocations) + { + $this->actionIdentification = new ActionIdentification($actionRequestCode); + $this->connectPointDetails = new ConnectPointDetails($connectionLocations); + } } diff --git a/src/Amadeus/Client/Struct/Ticket/CreateTSMFareElement.php b/src/Amadeus/Client/Struct/Ticket/CreateTSMFareElement.php index 71a0f197d..12d3d7679 100644 --- a/src/Amadeus/Client/Struct/Ticket/CreateTSMFareElement.php +++ b/src/Amadeus/Client/Struct/Ticket/CreateTSMFareElement.php @@ -54,7 +54,7 @@ public function __construct($requestOptions) { $this->fareElementTattoo = new FareElementTattoo( $requestOptions->tattoo, - $requestOptions->elementType + $requestOptions->type ); $this->fareElementInfo = new FareElementInfo($requestOptions->info); diff --git a/tests/Amadeus/Client/ResponseHandler/BaseTest.php b/tests/Amadeus/Client/ResponseHandler/BaseTest.php index 93f192ff5..a62bbe27e 100644 --- a/tests/Amadeus/Client/ResponseHandler/BaseTest.php +++ b/tests/Amadeus/Client/ResponseHandler/BaseTest.php @@ -1092,6 +1092,22 @@ public function testCanHandleTicketCheckEligibilityErrResponse() $this->assertEquals("application", $result->messages[0]->level); } + public function testCanHandleTicketAtcShopperMasterPricerTravelBoardSearchErrResponse() + { + $respHandler = new ResponseHandler\Base(); + + $sendResult = new SendResult(); + $sendResult->responseXml = $this->getTestFile('dummyTicketActShopperMasterPricerTravelBoardSearchErrorResponse.txt'); + + $result = $respHandler->analyzeResponse($sendResult, 'Ticket_ATCShopperMasterPricerTravelBoardSearch'); + + $this->assertEquals(Result::STATUS_ERROR, $result->status); + $this->assertEquals(1, count($result->messages)); + $this->assertEquals('866', $result->messages[0]->code); + $this->assertEquals("NO FARE FOUND FOR REQUESTED ITINERARY", $result->messages[0]->text); + $this->assertNull($result->messages[0]->level); + } + public function testCanHandleMiniRuleGetFromPricingRecErrResponse() { $respHandler = new ResponseHandler\Base(); diff --git a/tests/Amadeus/Client/ResponseHandler/testfiles/dummyTicketActShopperMasterPricerTravelBoardSearchErrorResponse.txt b/tests/Amadeus/Client/ResponseHandler/testfiles/dummyTicketActShopperMasterPricerTravelBoardSearchErrorResponse.txt new file mode 100644 index 000000000..0be416f7b --- /dev/null +++ b/tests/Amadeus/Client/ResponseHandler/testfiles/dummyTicketActShopperMasterPricerTravelBoardSearchErrorResponse.txt @@ -0,0 +1,20 @@ + + + + CXR + + + + + + 866 + + + + + 1 + + NO FARE FOUND FOR REQUESTED ITINERARY + + + diff --git a/tests/Amadeus/Client/Struct/Ticket/AtcShopperMasterPricerTravelBoardSearchTest.php b/tests/Amadeus/Client/Struct/Ticket/AtcShopperMasterPricerTravelBoardSearchTest.php new file mode 100644 index 000000000..120517816 --- /dev/null +++ b/tests/Amadeus/Client/Struct/Ticket/AtcShopperMasterPricerTravelBoardSearchTest.php @@ -0,0 +1,185 @@ + + */ +class AtcShopperMasterPricerTravelBoardSearchTest extends BaseTestCase +{ + /** + * 5.1 Operation: 0 - Search With Mandatory Elements + * + */ + public function testCanMakeMessageWithMandatoryParameters() + { + $opt = new TicketAtcShopperMpTbSearchOptions([ + 'nrOfRequestedPassengers' => 2, + 'nrOfRequestedResults' => 2, + 'passengers' => [ + new MPPassenger([ + 'type' => MPPassenger::TYPE_ADULT, + 'count' => 1 + ]), + new MPPassenger([ + 'type' => MPPassenger::TYPE_CHILD, + 'count' => 1 + ]) + ], + 'flightOptions' => [ + TicketAtcShopperMpTbSearchOptions::FLIGHTOPT_PUBLISHED, + TicketAtcShopperMpTbSearchOptions::FLIGHTOPT_UNIFARES + ], + 'itinerary' => [ + new MPItinerary([ + 'segmentReference' => 1, + 'departureLocation' => new MPLocation(['city' => 'MAD']), + 'arrivalLocation' => new MPLocation(['city' => 'LHR']), + 'date' => new MPDate([ + 'date' => new \DateTime('2013-08-12T00:00:00+0000', new \DateTimeZone('UTC')) + ]) + ]), + new MPItinerary([ + 'segmentReference' => 2, + 'departureLocation' => new MPLocation(['city' => 'LHR']), + 'arrivalLocation' => new MPLocation(['city' => 'MAD']), + 'date' => new MPDate([ + 'date' => new \DateTime('2013-12-12T00:00:00+0000', new \DateTimeZone('UTC')) + ]) + ]) + ], + 'ticketNumbers' => [ + '0572187777498', + '0572187777499' + ], + 'requestedSegments' => [ + new ReqSegOptions([ + 'requestCode' => ReqSegOptions::REQUEST_CODE_KEEP_FLIGHTS_AND_FARES, + 'connectionLocations' => [ + 'MAD', + 'LHR' + ] + ]), + new ReqSegOptions([ + 'requestCode' => ReqSegOptions::REQUEST_CODE_CHANGE_REQUESTED_SEGMENT, + 'connectionLocations' => [ + 'LHR', + 'MAD' + ] + ]) + ] + ]); + + $msg = new AtcShopperMasterPricerTravelBoardSearch($opt); + + $this->assertCount(2, $msg->numberOfUnit->unitNumberDetail); + $this->assertEquals(2, $msg->numberOfUnit->unitNumberDetail[0]->numberOfUnits); + $this->assertEquals(UnitNumberDetail::TYPE_PASS, $msg->numberOfUnit->unitNumberDetail[0]->typeOfUnit); + $this->assertEquals(2, $msg->numberOfUnit->unitNumberDetail[1]->numberOfUnits); + $this->assertEquals(UnitNumberDetail::TYPE_RESULTS, $msg->numberOfUnit->unitNumberDetail[1]->typeOfUnit); + + $this->assertNull($msg->combinationFareFamilies); + $this->assertNull($msg->customerRef); + $this->assertEmpty($msg->fareFamilies); + $this->assertNull($msg->feeOption); + $this->assertNull($msg->formOfPaymentByPassenger); + $this->assertNull($msg->globalOptions); + $this->assertNull($msg->officeIdDetails); + $this->assertNull($msg->priceToBeat); + $this->assertNull($msg->solutionFamily); + $this->assertNull($msg->taxInfo); + $this->assertEmpty($msg->valueSearch); + $this->assertNull($msg->travelFlightInfo); + + $this->assertCount(2, $msg->paxReference); + $this->assertEquals('ADT', $msg->paxReference[0]->ptc[0]); + $this->assertCount(1, $msg->paxReference[0]->traveller); + $this->assertEquals(1, $msg->paxReference[0]->traveller[0]->ref); + + $this->assertEquals('CH', $msg->paxReference[1]->ptc[0]); + $this->assertCount(1, $msg->paxReference[1]->traveller); + $this->assertEquals(2, $msg->paxReference[1]->traveller[0]->ref); + + $this->assertCount(2, $msg->itinerary); + $this->assertEquals(1, $msg->itinerary[0]->requestedSegmentRef->segRef); + $this->assertNull($msg->itinerary[0]->requestedSegmentRef->locationForcing); + $this->assertEquals('MAD', $msg->itinerary[0]->departureLocalization->departurePoint->locationId); + $this->assertEquals('LHR', $msg->itinerary[0]->arrivalLocalization ->arrivalPointDetails->locationId); + $this->assertEquals('120813', $msg->itinerary[0]->timeDetails->firstDateTimeDetail->date); + $this->assertNull($msg->itinerary[0]->timeDetails->firstDateTimeDetail->time); + $this->assertNull($msg->itinerary[0]->timeDetails->firstDateTimeDetail->timeWindow); + $this->assertNull($msg->itinerary[0]->timeDetails->firstDateTimeDetail->timeQualifier); + $this->assertNull($msg->itinerary[0]->timeDetails->rangeOfDate); + + $this->assertEquals(2, $msg->itinerary[1]->requestedSegmentRef->segRef); + $this->assertNull($msg->itinerary[1]->requestedSegmentRef->locationForcing); + $this->assertEquals('LHR', $msg->itinerary[1]->departureLocalization->departurePoint->locationId); + $this->assertEquals('MAD', $msg->itinerary[1]->arrivalLocalization ->arrivalPointDetails->locationId); + $this->assertEquals('121213', $msg->itinerary[1]->timeDetails->firstDateTimeDetail->date); + $this->assertNull($msg->itinerary[1]->timeDetails->firstDateTimeDetail->time); + $this->assertNull($msg->itinerary[1]->timeDetails->firstDateTimeDetail->timeWindow); + $this->assertNull($msg->itinerary[1]->timeDetails->firstDateTimeDetail->timeQualifier); + $this->assertNull($msg->itinerary[1]->timeDetails->rangeOfDate); + + $this->assertCount(2, $msg->ticketChangeInfo->ticketNumberDetails->documentDetails); + $this->assertEquals('0572187777498', $msg->ticketChangeInfo->ticketNumberDetails->documentDetails[0]->number); + $this->assertEquals('0572187777499', $msg->ticketChangeInfo->ticketNumberDetails->documentDetails[1]->number); + + $this->assertCount(2, $msg->ticketChangeInfo->ticketRequestedSegments); + $this->assertEquals(ActionIdentification::REQ_KEEP_FLIGHTS_AND_FARES, $msg->ticketChangeInfo->ticketRequestedSegments[0]->actionIdentification->actionRequestCode); + $this->assertNull($msg->ticketChangeInfo->ticketRequestedSegments[0]->actionIdentification->productDetails); + $this->assertCount(2, $msg->ticketChangeInfo->ticketRequestedSegments[0]->connectPointDetails->connectionDetails); + $this->assertEquals('MAD', $msg->ticketChangeInfo->ticketRequestedSegments[0]->connectPointDetails->connectionDetails[0]->location); + $this->assertEquals('LHR', $msg->ticketChangeInfo->ticketRequestedSegments[0]->connectPointDetails->connectionDetails[1]->location); + + $this->assertEquals(ActionIdentification::REQ_CHANGE_REQUESTED_SEGMENT, $msg->ticketChangeInfo->ticketRequestedSegments[1]->actionIdentification->actionRequestCode); + $this->assertNull($msg->ticketChangeInfo->ticketRequestedSegments[1]->actionIdentification->productDetails); + $this->assertCount(2, $msg->ticketChangeInfo->ticketRequestedSegments[1]->connectPointDetails->connectionDetails); + $this->assertEquals('LHR', $msg->ticketChangeInfo->ticketRequestedSegments[1]->connectPointDetails->connectionDetails[0]->location); + $this->assertEquals('MAD', $msg->ticketChangeInfo->ticketRequestedSegments[1]->connectPointDetails->connectionDetails[1]->location); + + $this->assertCount(2, $msg->fareOptions->pricingTickInfo->pricingTicketing->priceType); + $this->assertEquals( + [ + PricingTicketing::PRICETYPE_PUBLISHEDFARES, + PricingTicketing::PRICETYPE_UNIFARES + ], + $msg->fareOptions->pricingTickInfo->pricingTicketing->priceType + ); + } +} diff --git a/tests/Amadeus/Client/Struct/Ticket/CreateTSMFareElementTest.php b/tests/Amadeus/Client/Struct/Ticket/CreateTSMFareElementTest.php index ddc6c579d..a49f2fa7b 100644 --- a/tests/Amadeus/Client/Struct/Ticket/CreateTSMFareElementTest.php +++ b/tests/Amadeus/Client/Struct/Ticket/CreateTSMFareElementTest.php @@ -45,7 +45,7 @@ class CreateTSMFareElementTest extends BaseTestCase public function testCanMakeMessageDeleteFopFromTsm() { $opt = new TicketCreateTsmFareElOptions([ - 'elementType' => TicketCreateTsmFareElOptions::TYPE_FORM_OF_PAYMENT, + 'type' => TicketCreateTsmFareElOptions::TYPE_FORM_OF_PAYMENT, 'tattoo' => 18, 'info' => '#####', ]); @@ -65,7 +65,7 @@ public function testCanMakeMessageDeleteFopFromTsm() public function testCanMakeMessagePaymentCheck() { $opt = new TicketCreateTsmFareElOptions([ - 'elementType' => TicketCreateTsmFareElOptions::TYPE_FORM_OF_PAYMENT, + 'type' => TicketCreateTsmFareElOptions::TYPE_FORM_OF_PAYMENT, 'tattoo' => 18, 'info' => 'CHECK/EUR304.89', ]); diff --git a/tests/Amadeus/ClientTest.php b/tests/Amadeus/ClientTest.php index 8ecad7b69..e212332e2 100644 --- a/tests/Amadeus/ClientTest.php +++ b/tests/Amadeus/ClientTest.php @@ -1565,7 +1565,7 @@ public function testCanDoTicketCreateTSMFareElement() $expectedMessageResult = new Client\Struct\Ticket\CreateTSMFareElement( new Client\RequestOptions\TicketCreateTsmFareElOptions([ - 'elementType' => Client\RequestOptions\TicketCreateTsmFareElOptions::TYPE_FORM_OF_PAYMENT, + 'type' => Client\RequestOptions\TicketCreateTsmFareElOptions::TYPE_FORM_OF_PAYMENT, 'tattoo' => '18', 'info' => '#####', ]) @@ -1604,7 +1604,7 @@ public function testCanDoTicketCreateTSMFareElement() $response = $client->ticketCreateTSMFareElement( new Client\RequestOptions\TicketCreateTsmFareElOptions([ - 'elementType' => Client\RequestOptions\TicketCreateTsmFareElOptions::TYPE_FORM_OF_PAYMENT, + 'type' => Client\RequestOptions\TicketCreateTsmFareElOptions::TYPE_FORM_OF_PAYMENT, 'tattoo' => '18', 'info' => '#####', ]) @@ -1970,6 +1970,65 @@ public function testCanDoTicketTicketCheckEligibility() $this->assertEquals($messageResult, $response); } + public function testCanDoTicketAtcShopperMasterPricerTravelBoardSearch() + { + $mockSessionHandler = $this->getMockBuilder('Amadeus\Client\Session\Handler\HandlerInterface')->getMock(); + + $mockedSendResult = new Client\Session\Handler\SendResult(); + $mockedSendResult->responseXml = 'dummyTicketAtcShopperMasterPricerTravelBoardSearchMessage'; + + $messageResult = new Client\Result($mockedSendResult); + + $expectedMessageResult = new Client\Struct\Ticket\AtcShopperMasterPricerTravelBoardSearch( + new Client\RequestOptions\TicketAtcShopperMpTbSearchOptions([ + + ]) + ); + + $mockSessionHandler + ->expects($this->once()) + ->method('sendMessage') + ->with( + 'Ticket_ATCShopperMasterPricerTravelBoardSearch', + $expectedMessageResult, + ['endSession' => false, 'returnXml' => true] + ) + ->will($this->returnValue($mockedSendResult)); + $mockSessionHandler + ->expects($this->never()) + ->method('getLastResponse'); + $mockSessionHandler + ->expects($this->once()) + ->method('getMessagesAndVersions') + ->will($this->returnValue(['Ticket_ATCShopperMasterPricerTravelBoardSearch' => "13.1"])); + + $mockResponseHandler = $this->getMockBuilder('Amadeus\Client\ResponseHandler\ResponseHandlerInterface')->getMock(); + + $mockResponseHandler + ->expects($this->once()) + ->method('analyzeResponse') + ->with($mockedSendResult, 'Ticket_ATCShopperMasterPricerTravelBoardSearch') + ->will($this->returnValue($messageResult)); + + $par = new Params(); + $par->sessionHandler = $mockSessionHandler; + $par->requestCreatorParams = new Params\RequestCreatorParams([ + 'receivedFrom' => 'some RF string', + 'originatorOfficeId' => 'BRUXXXXXX' + ]); + $par->responseHandler = $mockResponseHandler; + + $client = new Client($par); + + $response = $client->ticketAtcShopperMasterPricerTravelBoardSearch( + new Client\RequestOptions\TicketAtcShopperMpTbSearchOptions([ + + ]) + ); + + $this->assertEquals($messageResult, $response); + } + public function testCanDoOfferConfirmAirOffer() { $mockSessionHandler = $this->getMockBuilder('Amadeus\Client\Session\Handler\HandlerInterface')->getMock();