Skip to content

Commit

Permalink
Implemented the Fare_InformativePricingWithoutPNR message (fixes #13)…
Browse files Browse the repository at this point in the history
… and provided documentation.
  • Loading branch information
DerMika committed Sep 12, 2016
1 parent aea3516 commit d8326f3
Show file tree
Hide file tree
Showing 34 changed files with 1,876 additions and 50 deletions.
6 changes: 6 additions & 0 deletions docs/how-to.rst
Original file line number Diff line number Diff line change
Expand Up @@ -154,3 +154,9 @@ You can override the default ``\SoapClient`` options by passing them in the Sess
\SoapClient options provided as such will override the default settings defined in
``Amadeus\Client\Session\Handler\Base::$soapClientOptions`` and must be provided in the correct
format as specified in the PHP manual: http://php.net/manual/en/soapclient.soapclient.php

================
EXAMPLE MESSAGES
================

See `examples <samples.rst>`_.
2 changes: 1 addition & 1 deletion docs/list-of-supported-messages.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ This is the list of messages that are at least partially supported at this time:
- Queue_MoveItem
- Fare_MasterPricerTravelBoardSearch
- Fare_PricePNRWithBookingClass
- Fare_InformativePricingWithoutPNR *
- Fare_InformativePricingWithoutPNR
- Fare_ConvertCurrency
- Fare_CheckRules
- Air_SellFromRecommendation
Expand Down
49 changes: 47 additions & 2 deletions docs/samples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
EXAMPLES
========

Here are some examples how to send specific messages.
Here are some examples of how to send specific messages.

***
PNR
Expand Down Expand Up @@ -415,6 +415,52 @@ Do a pricing on the PNR in context:
])
);
---------------------------------
Fare_InformativePricingWithoutPNR
---------------------------------

Do an informative pricing on BRU-LIS flight with 2 adults and no special pricing options:

.. code-block:: php
use Amadeus\Client\RequestOptions\FareInformativePricingWithoutPnrOptions;
use Amadeus\Client\RequestOptions\Fare\InformativePricing\Passenger;
use Amadeus\Client\RequestOptions\Fare\InformativePricing\Segment;
$informativePricingResponse = $client->fareInformativePricingWithoutPnr(
new FareInformativePricingWithoutPnrOptions([
'passengers' => [
new Passenger([
'tattoos' => [1, 2],
'type' => Passenger::TYPE_ADULT
])
],
'segments' => [
new Segment([
'departureDate' => \DateTime::createFromFormat('Y-m-d H:i:s', '2016-11-21 09:15:00'),
'from' => 'BRU',
'to' => 'LIS',
'marketingCompany' => 'TP',
'flightNumber' => '4652',
'bookingClass' => 'Y',
'segmentTattoo' => 1,
'groupNumber' => 1
]),
new Segment([
'departureDate' => \DateTime::createFromFormat('Y-m-d H:i:s', '2016-11-28 14:20:00'),
'from' => 'LIS',
'to' => 'BRU',
'marketingCompany' => 'TP',
'flightNumber' => '3581',
'bookingClass' => 'C',
'segmentTattoo' => 2,
'groupNumber' => 2
])
]
])
);
---------------
Fare_CheckRules
---------------
Expand Down Expand Up @@ -467,7 +513,6 @@ Convert 200 Euro to US Dollars in the exchange rate of 25th December 2015 *(this
])
);
***
Air
***
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,26 @@ class Passenger extends LoadParamsFromArray
{
const TYPE_ADULT = "ADT";

const TYPE_CHILD = "CHD";
const TYPE_CHILD = "CH";

const TYPE_INFANT = "INF";

/**
* How many passengers of this type
* @var integer
*/
public $amount;

/**
* 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 = [];
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?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\InformativePricing;

use Amadeus\Client\RequestOptions\FarePricePnrWithBookingClassOptions;

/**
* Pricing Options for the Fare_InformativePricingWithoutPNR message
*
* The pricing options are the same as a Fare_PricePnrWithBookingClassOptions
*
* @package Amadeus\Client\RequestOptions\Fare\InformativePricing
* @author Dieter Devlieghere <dieter.devlieghere@benelux.amadeus.com>
*/
class PricingOptions extends FarePricePnrWithBookingClassOptions
{

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,111 @@

namespace Amadeus\Client\RequestOptions\Fare\InformativePricing;

use Amadeus\Client\LoadParamsFromArray;

/**
* Segment
*
* @package Amadeus\Client\RequestOptions\Fare\InformativePricing
* @author Dieter Devlieghere <dieter.devlieghere@benelux.amadeus.com>
*/
class Segment
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;

/**
* Code for the airplane type
*
* @var string
*/
public $airplaneCode;

/**
* The number of stops
*
* @var int
*/
public $nrOfStops;

/**
* Unique segment tattoo ID.
*
* @var int
*/
public $segmentTattoo;

/**
* To group several segments into connected flights, use the same groupNumber
*
* The "flightTypeDetails/flightIndicator" is a group ID.
* Two flights having the same flightIndicator will be considered as being connected.
*
* @var int
*/
public $groupNumber;

/**
* Inventory of availability.
*
* Array keys are booking classes, values are how many available seats there are.
*
* e.g. ['Y' => 9, 'I' => 8]
*
* @var array
*/
public $inventory = [];
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class FareInformativePricingWithoutPnrOptions extends Base
public $segments = [];

/**
* @var Fare\InformativePricing\PricingOption[]
* @var Fare\InformativePricing\PricingOptions
*/
public $pricingOptions = [];
public $pricingOptions;
}
14 changes: 14 additions & 0 deletions src/Amadeus/Client/Struct/Air/FlightDate.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,18 @@ public function __construct($departureDate)
}
}
}

/**
* Load Arrival date info from \DateTime
*
* @param \DateTime $arrivalDate
*/
public function setArrivalDate(\DateTime $arrivalDate)
{
$this->arrivalDate = $arrivalDate->format('dmy');
$time = $arrivalDate->format('Hi');
if ($time !== "0000") {
$this->arrivalTime = $time;
}
}
}
3 changes: 2 additions & 1 deletion src/Amadeus/Client/Struct/Air/TravelProductInformation.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ class TravelProductInformation
*/
public function __construct($departureDate, $from, $to, $company, $flightNumber, $bookingClass)
{
$this->flightDate = new FlightDate($departureDate->format('dmy'));
//$this->flightDate = new FlightDate($departureDate->format('dmy'));
$this->flightDate = new FlightDate($departureDate);
$this->boardPointDetails = new PointDetails($from);
$this->offpointDetails = new PointDetails($to);
$this->companyDetails = new CompanyDetails($company);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?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\InformativePricing13;

/**
* AdditionalBusinessInformation
*
* @package Amadeus\Client\Struct\Fare\InformativePricing13
* @author Dieter Devlieghere <dieter.devlieghere@benelux.amadeus.com>
*/
class AdditionalBusinessInformation
{
/**
* @var SourceType
*/
public $sourceType;

/**
* @var OriginatorDetails
*/
public $originatorDetails;

/**
* @var LocationDetails
*/
public $locationDetails;

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

/**
* @var string
*/
public $systemCode;
}
Loading

0 comments on commit d8326f3

Please sign in to comment.