Skip to content

Commit

Permalink
New message: SalesReports_DisplayQueryReports - with tests & docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
DerMika committed Sep 14, 2016
1 parent b71e24a commit 13e4b59
Show file tree
Hide file tree
Showing 33 changed files with 3,500 additions and 8 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 2016-09

* Implemented SalesReports_DisplayQueryReport
* Added support for multiple WSDL's (interfaces) in a WSAP(https://github.com/amabnl/amadeus-ws-client/issues/5)
* PSR-2 code style enforced via StyleCI

# 2016-08

* Implemented PNR_DisplayHistory
Expand Down
2 changes: 1 addition & 1 deletion docs/list-of-supported-messages.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ This is the list of messages that are at least partially supported at this time:
- Info_EncodeDecodeCity
- Command_Cryptic
- PriceXplorer_ExtremeSearch
- SalesReports_DisplayQueryReport

On the to-do list / work in progress:

Expand All @@ -55,7 +56,6 @@ On the to-do list / work in progress:
- Ticket_DisplayTST
- Ticket_DeleteTST
- Ticket_CreateTSMFromPricing
- SalesReports_DisplayQueryReport
- Media_GetMedia
- Service_IntegratedPricing
- DocIssuance_IssueMiscellaneousDocuments
22 changes: 22 additions & 0 deletions docs/samples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -912,3 +912,25 @@ Request a basic Extreme Search result:
$extremeSearchResult = $client->priceXplorerExtremeSearch($opt);
*******************************
SalesReports_DisplayQueryReport
*******************************

Request a sales report from a certain date to another date, issued in all offices sharing the same IATA number;

.. code-block:: php
use Amadeus\Client\RequestOptions\SalesReportsDisplayQueryReportOptions;
$opt = new SalesReportsDisplayQueryReportOptions([
'requestOptions' => [
SalesReportsDisplayQueryReportOptions::SELECT_ALL_OFFICES_SHARING_IATA_NR
],
'agencySourceType' => SalesReportsDisplayQueryReportOptions::AGENCY_SRC_REPORTING_OFFICE,
'agencyIataNumber' => '23491193',
'startDate' => \DateTime::createFromFormat('Ymd', '20150101', new \DateTimeZone('UTC')),
'endDate' => \DateTime::createFromFormat('Ymd', '20160331', new \DateTimeZone('UTC'))
]);
$salesReportResult = $client->salesReportsDisplayQueryReport($opt);
15 changes: 14 additions & 1 deletion src/Amadeus/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
* TODO:
* - support older versions of SoapHeader (1)
* - implement calls for full online booking flow:
* SalesReports_DisplayQueryReport
* Air_MultiAvailability
*
* - implement more PNR_AddMultiElements:
Expand Down Expand Up @@ -663,6 +662,20 @@ public function priceXplorerExtremeSearch(RequestOptions\PriceXplorerExtremeSear
return $this->callMessage($msgName, $options, $messageOptions);
}

/**
* SalesReports_DisplayQueryReport
*
* @param RequestOptions\SalesReportsDisplayQueryReportOptions $options
* @param array $messageOptions
* @return Result
*/
public function salesReportsDisplayQueryReport(RequestOptions\SalesReportsDisplayQueryReportOptions $options, $messageOptions = [])
{
$msgName = 'SalesReports_DisplayQueryReport';

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

/**
* Call a message with the given parameters
*
Expand Down
14 changes: 12 additions & 2 deletions src/Amadeus/Client/RequestCreator/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@
use Amadeus\Client\RequestOptions\OfferConfirmCarOptions;
use Amadeus\Client\RequestOptions\OfferConfirmHotelOptions;
use Amadeus\Client\RequestOptions\OfferVerifyOptions;
use Amadeus\Client\RequestOptions\Pnr\Element\ReceivedFrom;
use Amadeus\Client\RequestOptions\PnrAddMultiElementsBase;
use Amadeus\Client\RequestOptions\PnrAddMultiElementsOptions;
use Amadeus\Client\RequestOptions\PnrCancelOptions;
use Amadeus\Client\RequestOptions\PnrCreatePnrOptions;
use Amadeus\Client\RequestOptions\PnrDisplayHistoryOptions;
Expand All @@ -54,6 +52,7 @@
use Amadeus\Client\RequestOptions\QueuePlacePnrOptions;
use Amadeus\Client\RequestOptions\QueueRemoveItemOptions;
use Amadeus\Client\RequestOptions\RequestOptionsInterface;
use Amadeus\Client\RequestOptions\SalesReportsDisplayQueryReportOptions;
use Amadeus\Client\RequestOptions\SecurityAuthenticateOptions;
use Amadeus\Client\RequestOptions\TicketCreateTstFromPricingOptions;
use Amadeus\Client\Struct;
Expand Down Expand Up @@ -453,6 +452,17 @@ protected function createPriceXplorerExtremeSearch(PriceXplorerExtremeSearchOpti
return new Struct\PriceXplorer\ExtremeSearch($params);
}

/**
* SalesReports_DisplayQueryReport
*
* @param SalesReportsDisplayQueryReportOptions $params
* @return Struct\SalesReports\DisplayQueryReport
*/
protected function createSalesReportsDisplayQueryReport(SalesReportsDisplayQueryReportOptions $params)
{
return new Struct\SalesReports\DisplayQueryReport($params);
}

/**
* Check if a given message is in the active WSDL. Throws exception if it isn't.
*
Expand Down
9 changes: 9 additions & 0 deletions src/Amadeus/Client/ResponseHandler/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,15 @@ protected function analyzePriceXplorerExtremeSearchResponse($response)
return $this->analyzeSimpleResponseErrorCodeAndMessage($response);
}

/**
* @param SendResult $response
* @return Result
*/
protected function analyzeSalesReportsDisplayQueryReportResponse($response)
{
return $this->analyzeSimpleResponseErrorCodeAndMessage($response);
}

/**
* @param SendResult $response WebService message Send Result
* @return Result
Expand Down
44 changes: 42 additions & 2 deletions src/Amadeus/Client/Struct/SalesReports/DisplayQueryReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,17 @@

use Amadeus\Client\RequestOptions\SalesReportsDisplayQueryReportOptions;
use Amadeus\Client\Struct\BaseWsMessage;
use Amadeus\Client\Struct\SalesReports\DisplayQueryReport\ActionDetails;
use Amadeus\Client\Struct\SalesReports\DisplayQueryReport\AgencyDetails;
use Amadeus\Client\Struct\SalesReports\DisplayQueryReport\AgentUserDetails;
use Amadeus\Client\Struct\SalesReports\DisplayQueryReport\CurrencyInfo;
use Amadeus\Client\Struct\SalesReports\DisplayQueryReport\DateDetails;
use Amadeus\Client\Struct\SalesReports\DisplayQueryReport\FormOfPaymentDetails;
use Amadeus\Client\Struct\SalesReports\DisplayQueryReport\RequestOption;
use Amadeus\Client\Struct\SalesReports\DisplayQueryReport\SalesIndicator;
use Amadeus\Client\Struct\SalesReports\DisplayQueryReport\SalesPeriodDetails;
use Amadeus\Client\Struct\SalesReports\DisplayQueryReport\TransactionData;
use Amadeus\Client\Struct\SalesReports\DisplayQueryReport\ValidatingCarrierDetails;

/**
* DisplayQueryReport
Expand Down Expand Up @@ -150,29 +160,41 @@ protected function loadRequestOptions($requestOptions)
*/
protected function loadAgencySource($agencySourceType, $iataNumber, $officeId)
{
if (!empty($agencySourceType) || !empty($iataNumber) || !empty($officeId)) {
$this->agencyDetails = new AgencyDetails($agencySourceType, $iataNumber, $officeId);
}
}

/**
* @param string|null $agentCode
*/
protected function loadAgent($agentCode)
{
if (!empty($agentCode)) {
$this->agentUserDetails = new AgentUserDetails($agentCode);
}
}

/**
* @param string|null $type
* @param string|null $code
* @param string|null $type
* @param string|null $issueIndicator
*/
protected function loadTransaction($type, $code, $issueIndicator)
protected function loadTransaction($code, $type, $issueIndicator)
{
if (!empty($type) || !empty($code) || !empty($issueIndicator)) {
$this->transactionData[] = new TransactionData($type, $code, $issueIndicator);
}
}

/**
* @param string|null $validatingCarrier
*/
protected function loadValidatingCarrier($validatingCarrier)
{
if (!empty($validatingCarrier)) {
$this->validatingCarrierDetails = new ValidatingCarrierDetails($validatingCarrier);
}
}

/**
Expand All @@ -181,6 +203,9 @@ protected function loadValidatingCarrier($validatingCarrier)
*/
protected function loadDateRange($startDate, $endDate)
{
if (!empty($startDate) || !empty($endDate)) {
$this->salesPeriodDetails = new SalesPeriodDetails($startDate, $endDate);
}
}

/**
Expand All @@ -189,6 +214,9 @@ protected function loadDateRange($startDate, $endDate)
*/
protected function loadDate($type, $date)
{
if (!empty($type) || !empty($date)) {
$this->dateDetails = new DateDetails($type, $date);
}
}

/**
Expand All @@ -197,6 +225,9 @@ protected function loadDate($type, $date)
*/
protected function loadCurrency($type, $currency)
{
if (!empty($type) || !empty($currency)) {
$this->currencyInfo = new CurrencyInfo($type, $currency);
}
}

/**
Expand All @@ -205,13 +236,19 @@ protected function loadCurrency($type, $currency)
*/
protected function loadFormOfPayment($type, $vendor)
{
if (!empty($type) || !empty($vendor)) {
$this->formOfPaymentDetails = new FormOfPaymentDetails($type, $vendor);
}
}

/**
* @param string $indicator
*/
protected function loadSalesIndicator($indicator)
{
if (!empty($indicator)) {
$this->salesIndicator = new SalesIndicator($indicator);
}
}

/**
Expand All @@ -220,5 +257,8 @@ protected function loadSalesIndicator($indicator)
*/
protected function loadScrolling($count, $fromItem)
{
if (!empty($count) || !empty($fromItem)) {
$this->actionDetails = new ActionDetails($count, $fromItem);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,30 @@
*/
class ActionDetails
{
/**
* @var NumberOfItemsDetails
*/
public $numberOfItemsDetails;

/**
* @var LastItemsDetails
*/
public $lastItemsDetails;

/**
* ActionDetails constructor.
*
* @param int|null $amount
* @param string|null $lastItem
*/
public function __construct($amount, $lastItem)
{
if (!empty($amount)) {
$this->numberOfItemsDetails = new NumberOfItemsDetails($amount);
}

if (!empty($lastItem)) {
$this->lastItemsDetails = new LastItemsDetails($lastItem);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,21 @@ class AgencyDetails
* @var OriginatorDetails
*/
public $originatorDetails;

/**
* AgencyDetails constructor.
*
* @param string $sourceType
* @param string $iataNumber
* @param string $officeId
*/
public function __construct($sourceType, $iataNumber, $officeId)
{
if (!empty($sourceType)) {
$this->sourceType = new SourceType($sourceType);
}
if (!empty($iataNumber) || !empty($officeId)) {
$this->originatorDetails = new OriginatorDetails($iataNumber, $officeId);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,25 @@
*/
class AgentUserDetails
{
/**
* @var OriginIdentification
*/
public $originIdentification;

/**
* A code given to an agent by the originating reservation system.
*
* @var string
*/
public $originator;

/**
* AgentUserDetails constructor.
*
* @param string $agentId
*/
public function __construct($agentId)
{
$this->originIdentification = new OriginIdentification($agentId);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php
/**
* Amadeus
*
* Copyright 2015 Amadeus Benelux NV
*/

namespace Amadeus\Client\Struct\SalesReports\DisplayQueryReport;

/**
* CompanyIdentification
*
* @package Amadeus\Client\Struct\SalesReports\DisplayQueryReport
* @author Dieter Devlieghere <dieter.devlieghere@benelux.amadeus.com>
*/
class CompanyIdentification
{
/**
* @var string
*/
public $marketingCompany;

/**
* CompanyIdentification constructor.
*
* @param string $company
*/
public function __construct($company)
{
$this->marketingCompany = $company;
}
}
Loading

0 comments on commit 13e4b59

Please sign in to comment.