Skip to content

Commit

Permalink
Implemented Ticket_CreateTSMFareElement for Amadeus Ticket Changer Sh…
Browse files Browse the repository at this point in the history
…opper flow (Issue #39)
  • Loading branch information
DerMika committed Feb 24, 2017
1 parent 9e3821a commit 64cf33c
Show file tree
Hide file tree
Showing 11 changed files with 444 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Release 1.3.0 (UNRELEASED)
* Implemented ``Ticket_CreateTSMFareElement`` message (https://github.com/amabnl/amadeus-ws-client/issues/39)

# Release 1.2.0 (23 February 2017)
* Fixed bug with Corporate Unifare pricing in ``Fare_MasterPricerTravelBoardSearch`` and ``Fare_MasterPricerCalendar`` (https://github.com/amabnl/amadeus-ws-client/pull/41) - Michal Hernas
* Added support for requesting rules for specific Fare Components after a pricing request in ``Fare_CheckRules`` (https://github.com/amabnl/amadeus-ws-client/issues/21)
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:
- FOP_CreateFormOfPayment
- Ticket_CreateTSTFromPricing
- Ticket_CreateTSMFromPricing
- Ticket_CreateTSMFareElement
- Ticket_DisplayTST
- Ticket_DisplayTSMP
- Ticket_DeleteTST
Expand Down Expand Up @@ -77,7 +78,6 @@ These messages will be implemented at some point in the future. *Pull requests a
- Ticket_ATCShopperMasterPricerTravelBoardSearch
- Ticket_RepricePNRWithBookingClass
- Ticket_ReissueConfirmedPricing
- Ticket_CreateTSMFareElement
- Ticket_ProcessEDoc
- Ticket_RetrieveListOfTSM
- Ticket_AddDocNumber
Expand Down
37 changes: 36 additions & 1 deletion docs/samples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1309,7 +1309,7 @@ Create a TSM from a Pricing previously made by a ``Service_IntegratedPricing`` c
use Amadeus\Client\RequestOptions\Ticket\Pricing;
use Amadeus\Client\RequestOptions\Ticket\PassengerReference;
$createTstResponse = $client->ticketCreateTSMFromPricing(
$createTsmResponse = $client->ticketCreateTSMFromPricing(
new TicketCreateTsmFromPricingOptions([
'pricings' => [
new Pricing([
Expand All @@ -1325,6 +1325,41 @@ Create a TSM from a Pricing previously made by a ``Service_IntegratedPricing`` c
])
);
---------------------------
Ticket_CreateTSMFareElement
---------------------------

Delete the form of payment from the TSM of tattoo 18:

*In order to delete a fare element, enter '##### ' as info*

.. code-block:: php
use Amadeus\Client\RequestOptions\TicketCreateTsmFareElOptions;
$createTsmResponse = $client->ticketCreateTSMFareElement(
new TicketCreateTsmFareElOptions([
'elementType' => TicketCreateTsmFareElOptions::TYPE_FORM_OF_PAYMENT,
'tattoo' => 18,
'info' => '#####'
])
);
Set the form of payment Check to the TSM of tattoo 18:

.. code-block:: php
use Amadeus\Client\RequestOptions\TicketCreateTsmFareElOptions;
$createTsmResponse = $client->ticketCreateTSMFareElement(
new TicketCreateTsmFareElOptions([
'elementType' => TicketCreateTsmFareElOptions::TYPE_FORM_OF_PAYMENT,
'tattoo' => 18,
'info' => 'CHECK/EUR304.89'
])
);
----------------
Ticket_DeleteTST
----------------
Expand Down
16 changes: 16 additions & 0 deletions src/Amadeus/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,22 @@ public function ticketCreateTSMFromPricing(
return $this->callMessage($msgName, $options, $messageOptions);
}

/**
* Ticket_CreateTSMFareElement
*
* @param RequestOptions\TicketCreateTsmFareElOptions $options
* @param array $messageOptions (OPTIONAL)
* @return Result
*/
public function ticketCreateTSMFareElement(
RequestOptions\TicketCreateTsmFareElOptions $options,
$messageOptions = []
) {
$msgName = 'Ticket_CreateTSMFareElement';

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

/**
* Ticket_DeleteTST
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?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\RequestCreator\Converter\Ticket;

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

/**
* Ticket_CreateTSMFareElement Request converter
*
* @package Amadeus\Client\RequestCreator\Converter\Ticket
* @author Dieter Devlieghere <dieter.devlieghere@benelux.amadeus.com>
*/
class CreateTSMFareElementConv extends BaseConverter
{
/**
* @param TicketCreateTsmFareElOptions $requestOptions
* @param int|string $version
* @return Struct\Ticket\CreateTSMFareElement
*/
public function convert($requestOptions, $version)
{
return new Struct\Ticket\CreateTSMFareElement($requestOptions);
}
}
62 changes: 62 additions & 0 deletions src/Amadeus/Client/RequestOptions/TicketCreateTsmFareElOptions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?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;

/**
* TicketCreateTsmFareElOptions
*
* @package Amadeus\Client\RequestOptions
* @author Dieter Devlieghere <dieter.devlieghere@benelux.amadeus.com>
*/
class TicketCreateTsmFareElOptions extends Base
{
const TYPE_FARE_DISCOUNT = "FD";
const TYPE_ENDORSEMENT = "FE";
const TYPE_COMMISSION = "FM";
const TYPE_ORIGINAL_EXCHANGE_DOCUMENT = "FO";
const TYPE_FORM_OF_PAYMENT = "FP";
const TYPE_TOUR_CODE = "FT";
const TYPE_MISCELLANEOUS_INFORMATION_1 = "FZ1";
const TYPE_MISCELLANEOUS_INFORMATION_2 = "FZ2";

/**
* Type of the Fare element of the associated TSM.
*
* @var string
*/
public $elementType;

/**
* The tattoo of the associated TSM.
*
* @var int
*/
public $tattoo;

/**
* Unstructured fare element information
*
* @var string
*/
public $info;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?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\ResponseHandler\Ticket;

/**
* HandlerCreateTSMFareElement
*
* @package Amadeus\Client\ResponseHandler\Ticket
* @author Dieter Devlieghere <dieter.devlieghere@benelux.amadeus.com>
*/
class HandlerCreateTSMFareElement extends HandlerDisplayTSMFareElement
{
}
62 changes: 62 additions & 0 deletions src/Amadeus/Client/Struct/Ticket/CreateTSMFareElement.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?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\Ticket;

use Amadeus\Client\RequestOptions\TicketCreateTsmFareElOptions;
use Amadeus\Client\Struct\BaseWsMessage;
use Amadeus\Client\Struct\Ticket\DisplayTSMFareElement\FareElementTattoo;

/**
* Ticket_CreateTSMFareElement
*
* @package Amadeus\Client\Struct\Ticket
* @author Dieter Devlieghere <dieter.devlieghere@benelux.amadeus.com>
*/
class CreateTSMFareElement extends BaseWsMessage
{
/**
* @var FareElementTattoo
*/
public $fareElementTattoo;

/**
* @var FareElementInfo
*/
public $fareElementInfo;


/**
* Ticket_CreateTSMFareElement constructor.
*
* @param TicketCreateTsmFareElOptions $requestOptions
*/
public function __construct($requestOptions)
{
$this->fareElementTattoo = new FareElementTattoo(
$requestOptions->tattoo,
$requestOptions->elementType
);

$this->fareElementInfo = new FareElementInfo($requestOptions->info);
}
}
47 changes: 47 additions & 0 deletions src/Amadeus/Client/Struct/Ticket/FareElementInfo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?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\Ticket;

/**
* FareElementInfo
*
* @package Amadeus\Client\Struct\Ticket
* @author Dieter Devlieghere <dieter.devlieghere@benelux.amadeus.com>
*/
class FareElementInfo
{
/**
* @var string
*/
public $text;

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

0 comments on commit 64cf33c

Please sign in to comment.