Skip to content

Commit

Permalink
Support for DK Number in Fare_MasterPricerTravelBoardSearch
Browse files Browse the repository at this point in the history
  • Loading branch information
DerMika committed Apr 4, 2017
1 parent 6ff209d commit 20c17ca
Show file tree
Hide file tree
Showing 9 changed files with 230 additions and 7 deletions.
7 changes: 4 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
# 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
* Added support for Progressive Legs in ``Fare_MasterPricerTravelBoardSearch`` (https://github.com/amabnl/amadeus-ws-client/issues/55)
* Added support for DK number (customer identification number) in ``Fare_MasterPricerTravelBoardSearch``
* Added support for Manual Commission elements in ``PNR_AddMultiElements`` (https://github.com/amabnl/amadeus-ws-client/issues/45)
* Added support for Service Fee indicator in Form of Payment elements in ``PNR_AddMultiElements``
* Added ``getLastRequestHeaders()`` and ``getLastResponseHeaders()`` methods (https://github.com/amabnl/amadeus-ws-client/issues/47)
* Automatically add a Received From element when not explicitly provided while calling the ``pnrAddMultiElements()`` method (https://github.com/amabnl/amadeus-ws-client/issues/50).
* Added support for recognizing ``general`` errors in PNR_Reply versions 14.1 and lower (https://github.com/amabnl/amadeus-ws-client/issues/51).
* Added support for recognizing ``general`` errors in PNR_Reply versions 14.1 and lower (https://github.com/amabnl/amadeus-ws-client/issues/51)
* 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_RepricePNRWithBookingClass`` message for ATC Shopper flow (https://github.com/amabnl/amadeus-ws-client/issues/39)
* Implemented ``Ticket_ReissueConfirmedPricing`` 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)
* Refactored ``Amadeus\Client\Session\Handler\Base`` to make it more readable.
* Refactored all parameter loading out of ``Amadeus\Client``.
* Refactored ``Amadeus\Client\Session\Handler\Base`` to make it more readable
* Refactored all parameter loading out of ``Amadeus\Client``

# Release 1.2.2 (8 March 2017)
* Fixed bug with Soap Header 4 WSDL's in combination with OTA XSD imports causing the AMA_SecurityHostedUser:UserID classmap to point to the wrong XSD element (https://github.com/amabnl/amadeus-ws-client/issues/48)
Expand Down
6 changes: 4 additions & 2 deletions docs/list-of-supported-messages.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ This is the list of messages that are at least partially supported at this time:
- Security_SignOut
- PNR_Retrieve
- PNR_RetrieveAndDisplay
- PNR_AddMultiElements (pnrCreate to create a PNR from scratch)
- PNR_AddMultiElements (possibility to do actionCode operations on a PNR in context without further actions)
- PNR_AddMultiElements *(both a dedicated PNR creation message and a "pure" PNR_AddMultiElements)*
- PNR_Cancel
- PNR_DisplayHistory
- PNR_TransferOwnership
Expand Down Expand Up @@ -81,6 +80,9 @@ These messages will be implemented at some point in the future. *Pull requests a
- Ticket_RetrieveListOfTSM
- Ticket_AddDocNumber
- TTR_DisplayTrip
- DocRefund_InitRefund
- DocRefund_UpdateRefund
- DocRefund_ProcessRefund
- Media_GetMedia
- Service_IntegratedCatalogue
- Service_PriceServiceViaCatalogue
Expand Down
40 changes: 40 additions & 0 deletions docs/samples/masterpricertravelboard.rst
Original file line number Diff line number Diff line change
Expand Up @@ -819,3 +819,43 @@ The example below illustrates a search with progressive legs range specified at
'progressiveLegsMax' => 1
]);
DK number (customer identification)
===================================

Provide a "DK" number / customer identification number to load specific business rules
to be taken into consideration by Amadeus when returning Fare Shopping results:

.. 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' => 'PAR']),
'arrivalLocation' => new MPLocation(['city' => 'PPT']),
'date' => new MPDate([
'dateTime' => new \DateTime('2012-08-10T00:00:00+0000', new \DateTimeZone('UTC'))
])
]),
new MPItinerary([
'departureLocation' => new MPLocation(['city' => 'PPT']),
'arrivalLocation' => new MPLocation(['city' => 'PAR']),
'date' => new MPDate([
'dateTime' => new \DateTime('2012-08-20T00:00:00+0000', new \DateTimeZone('UTC'))
])
])
],
'dkNumber' => 'AA1234567890123456789Z01234567890'
]);
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,11 @@ class FareMasterPricerTbSearch extends MpBaseOptions
* @var int
*/
public $progressiveLegsMax;

/**
* "DK" number / customer identification number
*
* @var string
*/
public $dkNumber;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@
class CustomerReferences
{
const QUAL_701 = 701;

/**
* @var int
* self::QUAL_*
*
* @var int|string
*/
public $referenceQualifier = self::QUAL_701;

Expand Down
37 changes: 37 additions & 0 deletions src/Amadeus/Client/Struct/Fare/MasterPricer/CustomerRef.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php
/**
* amadeus-ws-client
*
* Copyright 2015 Amadeus Benelux NV
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @package Amadeus
* @license https://opensource.org/licenses/Apache-2.0 Apache 2.0
*/

namespace Amadeus\Client\Struct\Fare\MasterPricer;

/**
* CustomerRef
*
* @package Amadeus\Client\Struct\Fare\MasterPricer
* @author Dieter Devlieghere <[email protected]>
*/
class CustomerRef
{
/**
* @var CustomerReferences[]
*/
public $customerReferences = [];
}
75 changes: 75 additions & 0 deletions src/Amadeus/Client/Struct/Fare/MasterPricer/CustomerReferences.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?php
/**
* amadeus-ws-client
*
* Copyright 2015 Amadeus Benelux NV
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @package Amadeus
* @license https://opensource.org/licenses/Apache-2.0 Apache 2.0
*/

namespace Amadeus\Client\Struct\Fare\MasterPricer;

/**
* CustomerReferences
*
* @package Amadeus\Client\Struct\Fare\MasterPricer
* @author Dieter Devlieghere <[email protected]>
*/
class CustomerReferences extends \Amadeus\Client\Struct\Air\MultiAvailability\CustomerReferences
{
const QUAL_UNIQUE_PAX_REF = 1;
const QUAL_PAX_SEQUENCE_NUMBER = 2;
const QUAL_PAX_STANDBY_NUMBER = 3;
const QUAL_PAX_BOARDING_SECURITY_NUMBER = 4;
const QUAL_PAX_TICKET_NUMBER = 5;
const QUAL_PAX_CONFIRMATION_NUMBER = 6;
const QUAL_DATE_OF_BIRTH = 7;
const QUAL_EXCEPTIONAL_PNR_SECURITY_ID = 700;
const QUAL_AGENCY_GROUPING_ID = 701;
const QUAL_TICKETING_DATA = 702;
const QUAL_MESSAGE_NUMBER_FOR_FREE_TEXT = 703;
const QUAL_ACCOUNT_PRODUCT_REF = "A";
const QUAL_BUSINESS = "B";
const QUAL_FAX = "F";
const QUAL_HOME = "H";
const QUAL_PAX_TRAVELLER_REF = "P";
const QUAL_SEGMENT_SERVICE_REF = "S";
const QUAL_TELETYPE_ADDRESS = "T";
const QUAL_NOT_KNOWN = "XX";

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

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

/**
* CustomerReferences constructor.
*
* @param string $reference Customer Reference
* @param int|string $qualifier Type of reference (self::QUAL_*)
*/
public function __construct($reference, $qualifier)
{
$this->referenceQualifier = $qualifier;

parent::__construct($reference);
}
}
20 changes: 19 additions & 1 deletion src/Amadeus/Client/Struct/Fare/MasterPricerTravelBoardSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class MasterPricerTravelBoardSearch extends BaseMasterPricerMessage
*/
public $globalOptions;
/**
* @var mixed
* @var MasterPricer\CustomerRef
*/
public $customerRef;
/**
Expand Down Expand Up @@ -168,6 +168,8 @@ protected function loadOptions($options)
}

$this->loadFareFamilies($options->fareFamilies);

$this->loadCustomerRefs($options->dkNumber);
}

/**
Expand Down Expand Up @@ -214,4 +216,20 @@ protected function loadFareFamilies($fareFamilies)
$this->fareFamilies[] = new MasterPricer\FareFamilies($fareFamily);
}
}

/**
* Load Customer references
*
* @param string $dkNumber
*/
protected function loadCustomerRefs($dkNumber)
{
if (!is_null($dkNumber)) {
$this->customerRef = new MasterPricer\CustomerRef();
$this->customerRef->customerReferences[] = new MasterPricer\CustomerReferences(
$dkNumber,
MasterPricer\CustomerReferences::QUAL_AGENCY_GROUPING_ID
);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
use Amadeus\Client\Struct\Fare\MasterPricer\BooleanExpression;
use Amadeus\Client\Struct\Fare\MasterPricer\CabinId;
use Amadeus\Client\Struct\Fare\MasterPricer\CompanyIdentity;
use Amadeus\Client\Struct\Fare\MasterPricer\CustomerReferences;
use Amadeus\Client\Struct\Fare\MasterPricer\FareFamilyInfo;
use Amadeus\Client\Struct\Fare\MasterPricer\FirstDateTimeDetail;
use Amadeus\Client\Struct\Fare\MasterPricer\FlightDetail;
Expand Down Expand Up @@ -1211,4 +1212,43 @@ public function testCanMakeMessageWithProgressiveLegs()

$this->assertCount(2, $message->travelFlightInfo->unitNumberDetail);
}

/**
* 5.31 Operation: 02.31 Flight Option - DK number (customer identification)
*/
public function testCanMakeMessageWithDkNumber()
{
$opt = new FareMasterPricerTbSearch([
'nrOfRequestedPassengers' => 1,
'passengers' => [
new MPPassenger([
'type' => MPPassenger::TYPE_ADULT,
'count' => 1
])
],
'itinerary' => [
new MPItinerary([
'departureLocation' => new MPLocation(['city' => 'PAR']),
'arrivalLocation' => new MPLocation(['city' => 'PPT']),
'date' => new MPDate([
'dateTime' => new \DateTime('2012-08-10T00:00:00+0000', new \DateTimeZone('UTC'))
])
]),
new MPItinerary([
'departureLocation' => new MPLocation(['city' => 'PPT']),
'arrivalLocation' => new MPLocation(['city' => 'PAR']),
'date' => new MPDate([
'dateTime' => new \DateTime('2012-08-20T00:00:00+0000', new \DateTimeZone('UTC'))
])
])
],
'dkNumber' => 'AA1234567890123456789Z01234567890'
]);

$message = new MasterPricerTravelBoardSearch($opt);

$this->assertCount(1, $message->customerRef->customerReferences);
$this->assertEquals('AA1234567890123456789Z01234567890', $message->customerRef->customerReferences[0]->referenceNumber);
$this->assertEquals(CustomerReferences::QUAL_AGENCY_GROUPING_ID, $message->customerRef->customerReferences[0]->referenceQualifier);
}
}

0 comments on commit 20c17ca

Please sign in to comment.