Skip to content

Commit

Permalink
Merge branch 'master' into fopcreatefop
Browse files Browse the repository at this point in the history
  • Loading branch information
DerMika committed Jan 11, 2017
2 parents ef0f8c3 + ce4801e commit fcebe74
Show file tree
Hide file tree
Showing 39 changed files with 615 additions and 150 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# Release 1.2.0 (Unreleased)
* Added support for requesting rules for specific Fare Components after a pricing request in ``Fare_CheckRules`` (https://github.com/amabnl/amadeus-ws-client/issues/21)
* Added support for requesting parametrized Fare Families in ``Fare_MasterPricerTravelBoardSearch`` and ``Fare_MasterPricerCalendar`` (https://github.com/amabnl/amadeus-ws-client/issues/31)
* Added a Client parameter to disable the population of the XML string in the Result object (https://github.com/amabnl/amadeus-ws-client/issues/33)
* Added a Client parameter to disable the population of the XML string in the Result object (https://github.com/amabnl/amadeus-ws-client/issues/33)
* Support for multiple ``optionCode`` in ``PNR_AddMultiElements`` and ``PNR_Cancel`` messages (https://github.com/amabnl/amadeus-ws-client/issues/34)
* Support for Currency Conversion in ``Fare_MasterPricerTravelBoardSearch`` (https://github.com/amabnl/amadeus-ws-client/issues/35)
* Support for Fee ID fare options in ``Fare_MasterPricerTravelBoardSearch`` (https://github.com/amabnl/amadeus-ws-client/pull/36) - Michal Hernas
* ``Queue_List``: added new request options:
- Search Criteria
- Sort by Creation, Ticketing or Departure date
Expand Down
10 changes: 5 additions & 5 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

73 changes: 73 additions & 0 deletions docs/samples/masterpricertravelboard.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
=======================================

Expand Down Expand Up @@ -658,3 +691,43 @@ Alternate Fare Family:
]
]);
Special parameters (FeeIds)
===========================

To turn on some functions in MasterPricer, you have to send special parameter (sometimes specific function has to be enabled for your office id).

Here is example how to get information about airlines fare families and get additional recommendation for homogoneus upsell:

.. 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;
use Amadeus\Client\RequestOptions\Fare\MPFeeId;
$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'))
])
])
],
'feeIds' => [
new MPFeeId(['type' => MPFeeId::FEETYPE_FARE_FAMILY_INFORMATION, 'number' => 3]),
new MPFeeId(['type' => MPFeeId::FEETYPE_HOMOGENOUS_UPSELL, 'number' => 6])
]
]);
20 changes: 20 additions & 0 deletions docs/samples/pnr-create-modify.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,26 @@ Samples for specific PNR Creation / modification scenario's

Below are some examples of how to do specific things with regards to creating & modifying PNR's:

------------------------------------
Multiple Action Codes (= optionCode)
------------------------------------

Usually, only one actionCode is needed. However, it iss also possible to provide multiple actionCodes in the request (= ``optionCode`` XML node):

.. code-block:: php
use Amadeus\Client\RequestOptions\PnrCreatePnrOptions;
$opt = new PnrCreatePnrOptions([
'actionCode' => [
PnrCreatePnrOptions::ACTION_END_TRANSACT_RETRIEVE, //11
PnrCreatePnrOptions::ACTION_WARNING_AT_EOT, //30
PnrCreatePnrOptions::ACTION_STOP_EOT_ON_SELL_ERROR //267
],
//Other options omitted
]);
------------------------------
Creating specific PNR elements
------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

use Amadeus\Client\RequestCreator\Converter\BaseConverter;
use Amadeus\Client\RequestOptions\FareCheckRulesOptions;
use Amadeus\Client\RequestOptions\FareMasterPricerCalendarOptions;
use Amadeus\Client\Struct;

/**
Expand Down
62 changes: 62 additions & 0 deletions src/Amadeus/Client/RequestOptions/Fare/MPFeeId.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?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\RequestOptions\Fare;

use Amadeus\Client\LoadParamsFromArray;

/**
* MasterPricer Fee Id request options.
*
* @package Amadeus\Client\RequestOptions\Fare
* @author Dieter Devlieghere <dieter.devlieghere@benelux.amadeus.com>
*/
class MPFeeId extends LoadParamsFromArray
{
const FEETYPE_ARP_NUMBER = "ARP";
const FEETYPE_FREE_BAGGAGE_ALLOWANCE = "FBA";
const FEETYPE_FARE_FAMILY_INFORMATION = "FFI";
const FEETYPE_NO_PNR_SPLIT = "NPS";
const FEETYPE_PRICE_TO_REACH_AMOUNT_TYPE = "PTRAM";
const FEETYPE_HAL_ROUND_TRIP_COMBINATION = "RTC";
const FEETYPE_SEARCH_BY_FBA = "SBF";
const FEETYPE_SORTING_OPTION = "SORT";
const FEETYPE_TOKEN = "TOKEN";
const FEETYPE_UPSELL_PER_BOUND = "UPB";
const FEETYPE_HOMOGENOUS_UPSELL = "UPH";

/**
* Fee Type
*
* self::FEETYPE_*
*
* @var string
*/
public $type;

/**
* Fee Id
*
* @var int
*/
public $number;
}
20 changes: 20 additions & 0 deletions src/Amadeus/Client/RequestOptions/FareMasterPricerTbSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,26 @@ 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;

/**
* FeeIds you want to pass on fare options level.
*
* @var Fare\MPFeeId[]
*/
public $feeIds;

/**
* Cabin class requested for the entire itinerary
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
class PnrAddMultiElementsBase extends PnrBase
{
/**
* One or more action codes to be performed on the PNR
*
* self::ACTION_* How to handle the PNR after creating
*
* 0 No special processing
Expand All @@ -47,7 +49,7 @@ class PnrAddMultiElementsBase extends PnrBase
* 30 Show warnings at first EOT
* 50 Reply with short message
*
* @var int
* @var int|int[]
*/
public $actionCode = 0;

Expand Down
2 changes: 1 addition & 1 deletion src/Amadeus/Client/RequestOptions/PnrCancelOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class PnrCancelOptions extends PnrBase
* 30 Show warnings at first EOT
* 50 Reply with short message
*
* @var int
* @var int|int[]
*/
public $actionCode = 0;

Expand Down
12 changes: 12 additions & 0 deletions src/Amadeus/Client/Struct/Fare/MasterPricer/ConversionRate.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,14 @@ class ConversionRateDetail
public $conversionType;

public $currency;

/**
* ConversionRateDetail constructor.
*
* @param $currency
*/
public function __construct($currency)
{
$this->currency = $currency;
}
}
62 changes: 56 additions & 6 deletions src/Amadeus/Client/Struct/Fare/MasterPricer/FareOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,23 +61,73 @@ 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
* @param \Amadeus\Client\RequestOptions\Fare\MPFeeId[]|null $flightOptions List of FeeIds
*/
public function __construct(array $flightOptions, array $corpCodesUniFares, $tickPreCheck)
public function __construct(array $flightOptions, array $corpCodesUniFares, $tickPreCheck, $currency, $feeIds)
{
$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);
if (!is_null($feeIds)) {
$this->loadFeeIds($feeIds);
}
}

/**
* Set fee ids if needed
*
* @param \Amadeus\Client\RequestOptions\Fare\MPFeeId[] $feeIds
*/
protected function loadFeeIds($feeIds)
{
if (is_null($this->feeIdDescription)) {
$this->feeIdDescription = new FeeIdDescription();
}
foreach ($feeIds as $feeId) {
$this->feeIdDescription->feeId[] = new FeeId($feeId->type, $feeId->number);
}
}

/**
* 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;
}
}

0 comments on commit fcebe74

Please sign in to comment.