Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
DerMika committed Feb 27, 2016
2 parents 50ff3f6 + 8d7a3cf commit ac2081f
Show file tree
Hide file tree
Showing 74 changed files with 5,059 additions and 106 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,15 @@ Update composer to get the client:
composer update
```

# Warning: under active development

This library is under active development. The public API's could change any time at the moment!

We will release a 0.1 version when we feel the library is stable enough, after which we will be following semantic versioning.

For now, if you want the bleeding edge, point your composer.json towards `dev-develop`. If you only want what we have verified as working, go for `dev-master`.

# Usage

- [About & Get Started](docs/about-get-started.rst)
- [Examples](docs/samples.rst)
- [Examples](docs/samples.rst)
9 changes: 6 additions & 3 deletions docs/about-get-started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ This is the list of messages that are at least partially supported at this time:
- Security_SignOut
- PNR_Retrieve
- PNR_RetrieveAndDisplay
- PNR_AddMultiElements *(Currently there is one call to create a PNR, later support will be added for modifying PNR's)*
- 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_Cancel
- Queue_List
- Queue_PlacePNR
- Queue_RemoveItem
Expand All @@ -104,9 +106,11 @@ This is the list of messages that are at least partially supported at this time:
- Air_SellFromRecommendation
- Offer_VerifyOffer
- Offer_ConfirmAirOffer
- Command_Cryptic
- MiniRule_GetFromPricingRec
- Ticket_CreateTSTFromPricing
- Command_Cryptic
- PriceXplorer_ExtremeSearch


We plan to support an entire basic booking flow (MasterPricer, SellFromRecommendation, Pricing, ...) later on.

Expand All @@ -126,7 +130,6 @@ On the to-do list / work in progress:
- Fare_CalculateMileage
- Info_EncodeDecodeCity
- Offer_ConfirmHotelOffer
- PriceXplorer_ExtremeSearch
- PointOfRef_Search
- Ticket_DisplayTST

233 changes: 196 additions & 37 deletions docs/samples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,23 @@ Creating a PNR (simplified example containing only the most basic PNR elements n
'value' => '+3222222222'
]);
//The required Received From (RF) element will automatically be added by the library.
//The required Received From (RF) element will automatically be added by the library if you didn't provide one.
$createdPnr = $client->pnrCreatePnr($opt);
Save a PNR which you have in context (created with actionCode 0 for example) and is now ready to be saved:

.. code-block:: php
use Amadeus\Client\RequestOptions\PnrAddMultiElementsOptions;
$pnrReply = $client->pnrAddMultiElements(
new PnrAddMultiElementsOptions([
'actionCode' => 11 //ET / END AND RETRIEVE
])
);
------------
PNR_Retrieve
------------
Expand All @@ -129,8 +142,10 @@ Retrieving a PNR:

.. code-block:: php
use Amadeus\Client\RequestOptions\PnrRetrieveOptions;
$pnrContent = $client->pnrRetrieve(
new Amadeus\Client\RequestOptions\PnrRetrieveOptions(['recordLocator' => 'ABC123'])
new PnrRetrieveOptions(['recordLocator' => 'ABC123'])
);
Expand All @@ -142,13 +157,83 @@ Retrieving a PNR with PNR content AND all offers:

.. code-block:: php
use Amadeus\Client\RequestOptions\PnrRetrieveAndDisplayOptions;
$pnrContent = $client->pnrRetrieveAndDisplay(
new Amadeus\Client\RequestOptions\PnrRetrieveAndDisplayOptions([
new PnrRetrieveAndDisplayOptions([
'recordLocator' => 'ABC123',
'retrieveOption' => Client\RequestOptions\PnrRetrieveAndDisplayOptions::RETRIEVEOPTION_ALL
'retrieveOption' => PnrRetrieveAndDisplayOptions::RETRIEVEOPTION_ALL
])
);
----------
PNR_Cancel
----------

Cancel the entire itinerary of the PNR in context and do an end transact to save the changes:

.. code-block:: php
use Amadeus\Client\RequestOptions\PnrCancelOptions;
$cancelReply = $client->pnrCancel(
new PnrCancelOptions([
'cancelItinerary' => true,
'actionCode' => 10
])
);
Cancel a PNR element with tatoo number 15 and do an End and Retrieve (ER) to receive the resulting PNR_Reply:

.. code-block:: php
use Amadeus\Client\RequestOptions\PnrCancelOptions;
$cancelReply = $client->pnrCancel(
new PnrCancelOptions([
'elementsByTatoo' => [15],
'actionCode' => 11
])
);
Same as before, but this time without having a PNR in context (you must provide the PNR's record locator)

.. code-block:: php
use Amadeus\Client\RequestOptions\PnrCancelOptions;
$cancelReply = $client->pnrCancel(
new PnrCancelOptions([
'recordLocator' => 'ABC123,
'elementsByTatoo' => [15],
'actionCode' => 11
])
);
Cancel the Offer with Offer reference 1:

.. code-block:: php
use Amadeus\Client\RequestOptions\PnrCancelOptions;
$cancelReply = $client->pnrCancel(
new PnrCancelOptions([
'offers' => [1]
])
);
Remove passenger with passenger reference 2 from the PNR:

.. code-block:: php
use Amadeus\Client\RequestOptions\PnrCancelOptions;
$cancelReply = $client->pnrCancel(
new PnrCancelOptions([
'passengers' => [2]
])
);
*****
Queue
Expand All @@ -162,9 +247,12 @@ Get a list of all PNR's on a given queue:

.. code-block:: php
use Amadeus\Client\RequestOptions\QueueListOptions;
use Amadeus\Client\RequestOptions\Queue;
$queueContent = $client->queueList(
new Amadeus\Client\RequestOptions\QueueListOptions([
'queue' => new Client\RequestOptions\Queue([
new QueueListOptions([
'queue' => new Queue([
'queue' => 50,
'category' => 0
])
Expand All @@ -179,9 +267,12 @@ Place a PNR on a queue:

.. code-block:: php
use Amadeus\Client\RequestOptions\QueuePlacePnrOptions;
use Amadeus\Client\RequestOptions\Queue;
$placeResult = $client->queuePlacePnr(
new Amadeus\Client\RequestOptions\QueuePlacePnrOptions([
'targetQueue' => new Client\RequestOptions\Queue([
new QueuePlacePnrOptions([
'targetQueue' => new Queue([
'queue' => 50,
'category' => 0
]),
Expand All @@ -197,9 +288,12 @@ Remove a PNR from a queue:

.. code-block:: php
use Amadeus\Client\RequestOptions\QueueRemoveItemOptions;
use Amadeus\Client\RequestOptions\Queue;
$removeResult = $client->queueRemoveItem(
new Amadeus\Client\RequestOptions\QueueRemoveItemOptions([
'queue' => new Amadeus\Client\RequestOptions\Queue([
new QueueRemoveItemOptions([
'queue' => new Queue([
'queue' => 50,
'category' => 0
]),
Expand All @@ -215,13 +309,16 @@ Move a PNR from one queue to another:

.. code-block:: php
use Amadeus\Client\RequestOptions\QueueMoveItemOptions;
use Amadeus\Client\RequestOptions\Queue;
$moveResult = $client->queueMoveItem(
new Amadeus\Client\RequestOptions\QueueMoveItemOptions([
'sourceQueue' => new Amadeus\Client\RequestOptions\Queue([
new QueueMoveItemOptions([
'sourceQueue' => new Queue([
'queue' => 50,
'category' => 0
]),
'destinationQueue' => new Amadeus\Client\RequestOptions\Queue([
'destinationQueue' => new Queue([
'queue' => 60,
'category' => 3
]),
Expand All @@ -241,20 +338,26 @@ Make a simple Masterpricer availability & fare search:

.. code-block:: php
$opt = new Amadeus\Client\RequestOptions\FareMasterPricerTbSearch([
use Amadeus\Client\RequestOptions\FareMasterPricerTbSearch;
use Amadeus\Client\RequestOptions\Fare\MPPassenger;
use Amadeus\Client\RequestOptions\Fare\MPItinerary;
use Amadeus\Client\RequestOptions\Fare\MPDate;
use Amadeus\Client\RequestOptions\Fare\MPLocation;
$opt = new FareMasterPricerTbSearch([
'nrOfRequestedResults' => 200,
'nrOfRequestedPassengers' => 1,
'passengers' => [
new Amadeus\Client\RequestOptions\Fare\MPPassenger([
'type' => Amadeus\Client\RequestOptions\Fare\MPPassenger::TYPE_ADULT,
new MPPassenger([
'type' => MPPassenger::TYPE_ADULT,
'count' => 1
])
],
'itinerary' => [
new Amadeus\Client\RequestOptions\Fare\MPItinerary([
'departureLocation' => new Amadeus\Client\RequestOptions\Fare\MPLocation(['city' => 'BRU']),
'arrivalLocation' => new Amadeus\Client\RequestOptions\Fare\MPLocation(['city' => 'LON']),
'date' => new Amadeus\Client\RequestOptions\Fare\MPDate([
new MPItinerary([
'departureLocation' => new MPLocation(['city' => 'BRU']),
'arrivalLocation' => new MPLocation(['city' => 'LON']),
'date' => new MPDate([
'date' => new \DateTime('2017-01-15T00:00:00+0000', new \DateTimeZone('UTC'))
])
])
Expand All @@ -271,11 +374,13 @@ Do a pricing on the PNR in context:

.. code-block:: php
$opt = new Amadeus\Client\RequestOptions\FarePricePnrWithBookingClassOptions([
'validatingCarrier' => 'SN'
]);
use Amadeus\Client\RequestOptions\FarePricePnrWithBookingClassOptions;
$pricingResponse = $client->farePricePnrWithBookingClass($opt);
$pricingResponse = $client->farePricePnrWithBookingClass(
new FarePricePnrWithBookingClassOptions([
'validatingCarrier' => 'SN'
])
);
***
Expand Down Expand Up @@ -327,6 +432,20 @@ Ticket_CreateTSTFromPricing

Create a TST from a Pricing made by a Fare_PricePNRWithBookingClass call:

.. code-block:: php
use Amadeus\Client\RequestOptions\TicketCreateTstFromPricingOptions;
use Amadeus\Client\RequestOptions\Ticket\Pricing;
$createTstResponse = $client->ticketCreateTSTFromPricing(
new TicketCreateTstFromPricingOptions([
'pricings' => [
new Pricing([
'tstNumber' => 1
])
]
])
);
-----------------
Ticket_DisplayTST
Expand All @@ -343,10 +462,31 @@ Offer_VerifyOffer
-----------------
Verify if an offer is still valid:

.. code-block:: php
use Amadeus\Client\RequestOptions\OfferVerifyOptions;
$offerVerifyResponse = $client->offerVerify(
new OfferVerifyOptions([
'offerReference' => 1,
'segmentName' => 'AIR'
])
);
---------------------
Offer_ConfirmAirOffer
---------------------
Confirm a given AIR offer:
Confirm a given AIR offer by providing office reference / tatoo:

.. code-block:: php
use Amadeus\Client\RequestOptions\OfferConfirmAirOptions;
$response = $client->offerConfirmAir(
new OfferConfirmAirOptions([
'tatooNumber' => 1
])
);
-----------------------
Offer_ConfirmHotelOffer
Expand All @@ -366,19 +506,17 @@ Get MiniRules for a pricing in context (either a TST pricing, Offers or a pricin
use Amadeus\Client\RequestOptions\MiniRuleGetFromPricingRecOptions;
use Amadeus\Client\RequestOptions\MiniRule\Pricing;
use Amadeus\Client;
$opt = new MiniRuleGetFromPricingRecOptions([
'pricings' => [
new Pricing([
'type' => Pricing::TYPE_TST,
'id' => Pricing::ALL_PRICINGS
])
]
]);
$miniRules = $client->miniRuleGetFromPricingRec($opt);
$miniRules = $client->miniRuleGetFromPricingRec(
new MiniRuleGetFromPricingRecOptions([
'pricings' => [
new Pricing([
'type' => Pricing::TYPE_TST,
'id' => Pricing::ALL_PRICINGS
])
]
])
);
***************
Expand All @@ -398,3 +536,24 @@ Send any cryptic Amadeus Selling Platform entry which does not have a structured
$crypticResponse = $client->commandCryptic($opt);
**************************
PriceXplorer_ExtremeSearch
**************************

Request a basic Extreme Search result:

.. code-block:: php
use Amadeus\Client\RequestOptions\PriceXplorerExtremeSearchOptions;
$opt = new PriceXplorerExtremeSearchOptions([
'resultAggregationOption' => PriceXplorerExtremeSearchOptions::AGGR_COUNTRY,
'origin' => 'BRU',
'destinations' => ['SYD', 'CBR'],
'earliestDepartureDate' => \DateTime::createFromFormat('Y-m-d','2016-08-25', new \DateTimeZone('UTC')),
'latestDepartureDate' => \DateTime::createFromFormat('Y-m-d','2016-09-28', new \DateTimeZone('UTC')),
'searchOffice' => 'LONBG2222'
]);
$extremeSearchResult = $client->priceXplorerExtremeSearch($opt);
Loading

0 comments on commit ac2081f

Please sign in to comment.