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

Add Fare_TLAGetFareRules message #456

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
## Unreleased
* Implemented ``Fare_TLAGetFareRules``
* Added ``Dockerfile`` for local development

## Release 1.13.0 (5 Apr 2021)
* Add support for multiple pax types in Fare_MasterPricerTravelBoardSearch (https://github.com/amabnl/amadeus-ws-client/pull/432) - Artem Zakharchenko
Expand Down
8 changes: 8 additions & 0 deletions docker/20-xdebug.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
xdebug.mode=debug
xdebug.client_port=9000
xdebug.idekey=xdebug
xdebug.discover_client_host=1
; we would receive errors from xdebug if we use the cli
; if you need xdebug logs, change this to https://xdebug.org/docs/all_settings#log_level
; @see https://stackoverflow.com/questions/65213171/disable-xdebug-3-could-not-connect-message-in-cli
xdebug.log_level=0
19 changes: 19 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM php:7.4-fpm-alpine3.16

RUN apk upgrade --no-cache --ignore alpine-baselayout \
&& apk --no-cache add git libzip-dev libxml2-dev libxslt-dev

RUN set -xe \
&& apk add --no-cache --virtual .build-deps \
$PHPIZE_DEPS \
coreutils \
&& docker-php-ext-install -j"$(/usr/bin/nproc)" zip soap xsl \
&& pecl install xdebug \
&& docker-php-ext-enable xdebug \
&& apk del .build-deps

COPY ./20-xdebug.ini /tmp/xdebug.ini
RUN cat /tmp/xdebug.ini >> $PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini

COPY . /var/www
WORKDIR /var/www
1 change: 1 addition & 0 deletions docs/list-of-supported-messages.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ This is the list of messages that are at least partially supported at this time:
- Fare_CheckRules
- Fare_GetFareRules
- Fare_GetFareFamilyDescription
- Fare_TLAGetFareRules
- Air_MultiAvailability
- Air_SellFromRecommendation
- Air_FlightInfo
Expand Down
19 changes: 17 additions & 2 deletions docs/samples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1435,6 +1435,23 @@ Convert 200 Euro to US Dollars in the exchange rate of 25th December 2015 *(this
])
);

--------------------
Fare_TLAGetFareRules
--------------------

Get fare rules for TLA carriers:

.. code-block:: php

use Amadeus\Client\RequestOptions\FareTLAGetFareRulesOptions;

$rulesResponse = $client->fareTLAGetFareRules(
new FareTLAGetFareRulesOptions([
'airlineCode' => '2U',
'tariffClassId' => 'OB'
])
);

***
Air
***
Expand Down Expand Up @@ -4182,5 +4199,3 @@ that 'salesIndicator' option here named as 'documentInfo' and request doesn't ha
]);

$salesReportResult = $client->salesReportsDisplayQueryReport($opt);


17 changes: 17 additions & 0 deletions src/Amadeus/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,23 @@ public function fareGetFareRules(RequestOptions\FareGetFareRulesOptions $options
return $this->callMessage($msgName, $options, $messageOptions);
}

/**
* Fare_TLAGetFareRules
*
* @param RequestOptions\FareTLAGetFareRulesOptions $options
* @param array $messageOptions (OPTIONAL)
* @return Result
* @throws Client\InvalidMessageException
* @throws Client\RequestCreator\MessageVersionUnsupportedException
* @throws Exception
*/
public function fareTLAGetFareRules(RequestOptions\FareTLAGetFareRulesOptions $options, $messageOptions = [])
{
$msgName = 'Fare_TLAGetFareRules';

return $this->callMessage($msgName, $options, $messageOptions);
}

/**
* Fare_ConvertCurrency
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace Amadeus\Client\RequestCreator\Converter\Fare;

use Amadeus\Client\RequestCreator\Converter\BaseConverter;
use Amadeus\Client\RequestOptions\FareTLAGetFareRulesOptions;
use Amadeus\Client\Struct;

class TLAGetFareRulesConv extends BaseConverter
{

/**
* @param FareTLAGetFareRulesOptions $requestOptions
* @param int|string $version
* @return Struct\Fare\TLAGetFareRules
*/

/**
* @param FareTLAGetFareRulesOptions $requestOptions
* @param string|int $version
* @return Struct\Fare\TLAGetFareRules
*/
public function convert($requestOptions, $version)
{
return new Struct\Fare\TLAGetFareRules($requestOptions);
}
}
16 changes: 16 additions & 0 deletions src/Amadeus/Client/RequestOptions/FareTLAGetFareRulesOptions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace Amadeus\Client\RequestOptions;

class FareTLAGetFareRulesOptions extends Base
{
/**
* @var string
*/
public $airlineCode;

/**
* @var string
*/
public $tariffClassId;
}
14 changes: 14 additions & 0 deletions src/Amadeus/Client/ResponseHandler/Fare/HandlerTLAGetFareRules.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace Amadeus\Client\ResponseHandler\Fare;

use Amadeus\Client\ResponseHandler\StandardResponseHandler;
use Amadeus\Client\Session\Handler\SendResult;

class HandlerTLAGetFareRules extends StandardResponseHandler
{
public function analyze(SendResult $response)
{
return $this->analyzeSimpleResponseErrorCodeAndMessage($response);
}
}
21 changes: 21 additions & 0 deletions src/Amadeus/Client/Struct/Fare/MessageFunctionInfo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace Amadeus\Client\Struct\Fare;

class MessageFunctionInfo
{
/**
* @var MessageFunctionDetails
*/
public $messageFunctionDetails;

/**
* Create msgType
*
* @param string|null $messageFunction
*/
public function __construct($messageFunction = null)
{
$this->messageFunctionDetails = new MessageFunctionDetails($messageFunction);
}
}
28 changes: 28 additions & 0 deletions src/Amadeus/Client/Struct/Fare/TLAGetFareRules.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace Amadeus\Client\Struct\Fare;

use Amadeus\Client\RequestOptions\FareTLAGetFareRulesOptions;
use Amadeus\Client\Struct\BaseWsMessage;
use Amadeus\Client\Struct\Fare\TLAGetFareRules\FareBasisInfo;

class TLAGetFareRules extends BaseWsMessage
{
public $messageFunctionInfo;

public $fareBasisInfo;

/**
* @param FareTLAGetFareRulesOptions $options
*/
public function __construct(FareTLAGetFareRulesOptions $options)
{
$this->messageFunctionInfo = new MessageFunctionInfo(MessageFunctionDetails::FARE_DISPLAY_RULES);
$this->loadFareBasisInfo($options);
}

private function loadFareBasisInfo(FareTLAGetFareRulesOptions $options)
{
$this->fareBasisInfo = new FareBasisInfo($options->tariffClassId, $options->airlineCode);
}
}
24 changes: 24 additions & 0 deletions src/Amadeus/Client/Struct/Fare/TLAGetFareRules/CompanyDetails.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

namespace Amadeus\Client\Struct\Fare\TLAGetFareRules;

class CompanyDetails
{
const COMPANY_INDUSTRY_CAR_RENTAL = '7CC';
const COMPANY_INDUSTRY_HOTEL_CHAINS = '7HH';

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

/**
* CompanyDetails constructor.
*
* @param string $marketingCompany
*/
public function __construct($marketingCompany)
{
$this->marketingCompany = $marketingCompany;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

namespace Amadeus\Client\Struct\Fare\TLAGetFareRules;

class FareBasisDetails
{
/**
* @var string
*/
public $tariffClassId;

/**
* @var CompanyDetails
*/
public $companyDetails;

/**
* @param string $tariffClassId
* @param string $marketingCompany
*/
public function __construct($tariffClassId, $marketingCompany)
{
$this->tariffClassId = $tariffClassId;
$this->companyDetails = new CompanyDetails($marketingCompany);
}
}
20 changes: 20 additions & 0 deletions src/Amadeus/Client/Struct/Fare/TLAGetFareRules/FareBasisInfo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace Amadeus\Client\Struct\Fare\TLAGetFareRules;

class FareBasisInfo
{
/**
* @var FareBasisDetails
*/
public $fareBasisDetails;

/**
* @param string $tariffClassId
* @param string $marketingCompany
*/
public function __construct($tariffClassId, $marketingCompany)
{
$this->fareBasisDetails = new FareBasisDetails($tariffClassId, $marketingCompany);
}
}
13 changes: 13 additions & 0 deletions tests/Amadeus/Client/ResponseHandler/BaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1971,4 +1971,17 @@ public function testCanHandlePNRSplit()
$this->assertEquals(Result::STATUS_OK, $result->status);
$this->assertEquals(0, count($result->messages));
}

public function testCanHandleFareTLAGetFareRules()
{
$respHandler = new ResponseHandler\Base();

$sendResult = new SendResult();
$sendResult->responseXml = $this->getTestFile('dummyFareTLAGetFareRulesResponse.txt');

$result = $respHandler->analyzeResponse($sendResult, 'Fare_TLAGetFareRules');

$this->assertEquals(Result::STATUS_OK, $result->status);
$this->assertEquals(0, count($result->messages));
}
}
Loading