Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance Fare_GetFareFamilyDescription: Request Airline Fare Family by standalone request parameters #445

Merged
merged 1 commit into from
Oct 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 46 additions & 2 deletions docs/samples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1296,9 +1296,9 @@ Get fare rules providing corporate number and departure date:
])
);

-----------------
-----------------------------
Fare_GetFareFamilyDescription
-----------------
-----------------------------

Basic request to get Fare Families in stateful mode (after pricing):

Expand All @@ -1318,6 +1318,50 @@ Basic request to get Fare Families in stateful mode (after pricing):
])
);

Requesting an Airline Fare Family (AFF) description in standalone mode:

.. code-block:: php

use Amadeus\Client\RequestOptions\FareGetFareFamilyDescriptionOptions;
use Amadeus\Client\RequestOptions\Fare\GetFareFamilyDescription;

$fareFamiliesResponse = $client->fareGetFareFamilyDescription(
new FareGetFareFamilyDescriptionOptions([
'bookingDateInformation' => new \DateTime('2021-10-08'),
'standaloneDescriptionRequest' => new GetFareFamilyDescription\StandaloneDescriptionRequest([
'items' => [
new GetFareFamilyDescription\StandaloneDescriptionRequestOption([
'fareInfo' => new GetFareFamilyDescription\FareInfo([
'fareQualifier' => 'FF',
'rateCategory' => 'BASICECON',
]),
'itineraryInfo' => new GetFareFamilyDescription\ItineraryInfo([
'origin' => 'JFK',
'destination' => 'DUB',
]),
'carrierInfo' => new GetFareFamilyDescription\CarrierInfo([
'airline' => 'DL',
]),
]),
new GetFareFamilyDescription\StandaloneDescriptionRequestOption([
'fareInfo' => new GetFareFamilyDescription\FareInfo([
'fareQualifier' => 'FF',
'rateCategory' => 'BASIC',
]),
'itineraryInfo' => new GetFareFamilyDescription\ItineraryInfo([
'origin' => 'MIA',
'destination' => 'AUA',
]),
'carrierInfo' => new GetFareFamilyDescription\CarrierInfo([
'airline' => 'AA',
]),
]),
],
]),
]),
);


--------------------
Fare_ConvertCurrency
--------------------
Expand Down
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\RequestOptions\Fare\GetFareFamilyDescription;

use Amadeus\Client\LoadParamsFromArray;

/**
* CarrierInfo class.
*
* @package Amadeus\Client\RequestOptions\Fare\GetFareFamilyDescription
* @author Artem Zakharchenko <artz.relax@gmail.com>
*/
class CarrierInfo extends LoadParamsFromArray
{
/** @var string */
public $airline;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?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\GetFareFamilyDescription;

use Amadeus\Client\LoadParamsFromArray;

/**
* FareInfo class.
*
* @package Amadeus\Client\RequestOptions\Fare\GetFareFamilyDescription
* @author Artem Zakharchenko <artz.relax@gmail.com>
*/
class FareInfo extends LoadParamsFromArray
{
/** @var string */
public $fareQualifier;

/** @var string */
public $rateCategory;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?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\GetFareFamilyDescription;

use Amadeus\Client\LoadParamsFromArray;

/**
* ItineraryInfo class.
*
* @package Amadeus\Client\RequestOptions\Fare\GetFareFamilyDescription
* @author Artem Zakharchenko <artz.relax@gmail.com>
*/
class ItineraryInfo extends LoadParamsFromArray
{
/** @var string */
public $origin;

/** @var string */
public $destination;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?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\GetFareFamilyDescription;

use Amadeus\Client\LoadParamsFromArray;

/**
* StandaloneDescriptionRequestOption collection.
*
* @package Amadeus\Client\RequestOptions\Fare\GetFareFamilyDescription
* @author Artem Zakharchenko <artz.relax@gmail.com>
*/
class StandaloneDescriptionRequest extends LoadParamsFromArray
{
/**
* @var StandaloneDescriptionRequestOption[]
*/
public $items = [];
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?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\GetFareFamilyDescription;

use Amadeus\Client\LoadParamsFromArray;

/**
* StandaloneDescriptionRequestOption class.
*
* @package Amadeus\Client\RequestOptions\Fare\GetFareFamilyDescription
* @author Artem Zakharchenko <artz.relax@gmail.com>
*/
class StandaloneDescriptionRequestOption extends LoadParamsFromArray
{
/** @var FareInfo */
public $fareInfo;

/** @var ItineraryInfo */
public $itineraryInfo;

/** @var CarrierInfo */
public $carrierInfo;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Amadeus\Client\RequestOptions;

use Amadeus\Client\RequestOptions\Fare\GetFareFamilyDescription\StandaloneDescriptionRequest;

/**
* Class FareGetFareFamilyDescriptionOptions
* @package Amadeus\Client\RequestOptions
Expand All @@ -12,4 +14,10 @@ class FareGetFareFamilyDescriptionOptions extends Base
* @var ReferenceGroup[]|array
*/
public $referenceGroups = [];

/** @var \DateTime|null */
public $bookingDateInformation;

/** @var StandaloneDescriptionRequest|null */
public $standaloneDescriptionRequest;
}
25 changes: 25 additions & 0 deletions src/Amadeus/Client/Struct/Fare/GetFareFamilyDescription.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@
use Amadeus\Client\RequestOptions\FareGetFareFamilyDescriptionOptions;
use Amadeus\Client\RequestOptions\Reference;
use Amadeus\Client\Struct\BaseWsMessage;
use Amadeus\Client\Struct\Fare\GetFareFamilyDescription\BookingDateInformation;
use Amadeus\Client\Struct\Fare\GetFareFamilyDescription\CarrierInformation;
use Amadeus\Client\Struct\Fare\GetFareFamilyDescription\FareInformation;
use Amadeus\Client\Struct\Fare\GetFareFamilyDescription\ItineraryInformation;
use Amadeus\Client\Struct\Fare\GetFareFamilyDescription\ReferenceDetails;
use Amadeus\Client\Struct\Fare\GetFareFamilyDescription\ReferenceInformation;
use Amadeus\Client\Struct\Fare\GetFareFamilyDescription\StandaloneDescriptionRequest;

/**
* Class GetFareFamilyDescription
Expand All @@ -19,6 +24,12 @@ class GetFareFamilyDescription extends BaseWsMessage
*/
public $referenceInformation;

/** @var BookingDateInformation */
public $bookingDateInformation;

/** @var StandaloneDescriptionRequest[] */
public $standaloneDescriptionRequest;

/**
* GetFareFamilyDescription constructor.
*
Expand All @@ -36,5 +47,19 @@ public function __construct($options)

$this->referenceInformation[] = new ReferenceInformation($references);
}

if ($bookingDateInformation = $options->bookingDateInformation) {
$this->bookingDateInformation = new BookingDateInformation($bookingDateInformation);
}

if ($standaloneDescriptionRequest = $options->standaloneDescriptionRequest) {
foreach ($standaloneDescriptionRequest->items as $standaloneDescriptionRequestOption) {
$this->standaloneDescriptionRequest[] = new StandaloneDescriptionRequest(
new FareInformation($standaloneDescriptionRequestOption->fareInfo),
new ItineraryInformation($standaloneDescriptionRequestOption->itineraryInfo),
new CarrierInformation($standaloneDescriptionRequestOption->carrierInfo)
);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?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\GetFareFamilyDescription;

/**
* BookingDateInformation
*
* @package Amadeus\Client\Struct\Fare\GetFareFamilyDescription
* @author Artem Zakharchenko <artz.relax@gmail.com>
*/
class BookingDateInformation
{
/** @var DateTime */
public $dateTime;

public function __construct(\DateTime $dateTime)
{
$this->dateTime = new DateTime($dateTime);
}
}
Loading