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

DocRefund_UpdateRefund implementation #74

Merged
merged 6 commits into from
May 7, 2017
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* Added support for Credit Card Holder name when adding FP elements with ``PNR_AddMultiElements`` (https://github.com/amabnl/amadeus-ws-client/issues/69)
* Added the possibility to disable the automatic addition of an RF element on each ``PNR_AddMultiElements`` call (https://github.com/amabnl/amadeus-ws-client/issues/68)
* Implemented ``DocRefund_InitRefund`` (https://github.com/amabnl/amadeus-ws-client/issues/56)
* Implemented ``DocRefund_UpdateRefund`` (https://github.com/amabnl/amadeus-ws-client/issues/56)
* Fixed a bug with building the correct version of a message (https://github.com/amabnl/amadeus-ws-client/issues/71)

# Release 1.3.0 (5 April 2017)
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 @@ -47,6 +47,7 @@ This is the list of messages that are at least partially supported at this time:
- DocIssuance_IssueMiscellaneousDocuments
- DocIssuance_IssueCombined
- DocRefund_InitRefund
- DocRefund_UpdateRefund
- Service_IntegratedPricing
- Offer_CreateOffer
- Offer_VerifyOffer
Expand Down Expand Up @@ -81,7 +82,6 @@ These messages will be implemented at some point in the future. *Pull requests a
- Ticket_RetrieveListOfTSM
- Ticket_AddDocNumber
- TTR_DisplayTrip
- DocRefund_UpdateRefund
- DocRefund_ProcessRefund
- Media_GetMedia
- Service_IntegratedCatalogue
Expand Down
202 changes: 202 additions & 0 deletions docs/samples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1927,6 +1927,207 @@ Refund with item number and coupon number:
);


----------------------
DocRefund_UpdateRefund
----------------------

Example how to perform a ticket conjunction:

.. code-block:: php

use Amadeus\Client\RequestOptions\DocRefundUpdateRefundOptions;
use Amadeus\Client\RequestOptions\DocRefund\Reference;
use Amadeus\Client\RequestOptions\DocRefund\Ticket;
use Amadeus\Client\RequestOptions\DocRefund\TickGroupOpt;
use Amadeus\Client\RequestOptions\DocRefund\MonetaryData;
use Amadeus\Client\RequestOptions\DocRefund\TaxData;
use Amadeus\Client\RequestOptions\DocRefund\FopOpt;
use Amadeus\Client\RequestOptions\DocRefund\FreeTextOpt;

$refundResponse = $client->docRefundUpdateRefund(
new DocRefundUpdateRefundOptions([
'originator' => '0001AA',
'originatorId' => '23491193',
'refundDate' => \DateTime::createFromFormat('Ymd', '20031125'),
'ticketedDate' => \DateTime::createFromFormat('Ymd', '20030522'),
'references' => [
new Reference([
'type' => Reference::TYPE_TKT_INDICATOR,
'value' => 'Y'
]),
new Reference([
'type' => Reference::TYPE_DATA_SOURCE,
'value' => 'F'
])
],
'tickets' => [
new Ticket([
'number' => '22021541124593',
'ticketGroup' => [
new TickGroupOpt([
'couponNumber' => TickGroupOpt::COUPON_1,
'couponStatus' => TickGroupOpt::STATUS_REFUNDED,
'boardingPriority' => 'LH07A'
]),
new TickGroupOpt([
'couponNumber' => TickGroupOpt::COUPON_2,
'couponStatus' => TickGroupOpt::STATUS_REFUNDED,
'boardingPriority' => 'LH07A'
]),
new TickGroupOpt([
'couponNumber' => TickGroupOpt::COUPON_3,
'couponStatus' => TickGroupOpt::STATUS_REFUNDED,
'boardingPriority' => 'LH07A'
]),
new TickGroupOpt([
'couponNumber' => TickGroupOpt::COUPON_4,
'couponStatus' => TickGroupOpt::STATUS_REFUNDED,
'boardingPriority' => 'LH07A'
])
]
]),
new Ticket([
'number' => '22021541124604',
'ticketGroup' => [
new TickGroupOpt([
'couponNumber' => TickGroupOpt::COUPON_1,
'couponStatus' => TickGroupOpt::STATUS_REFUNDED,
'boardingPriority' => 'LH07A'
]),
new TickGroupOpt([
'couponNumber' => TickGroupOpt::COUPON_2,
'couponStatus' => TickGroupOpt::STATUS_REFUNDED,
'boardingPriority' => 'LH07A'
])
]
])
],
'travellerPrioDateOfJoining' => \DateTime::createFromFormat('Ymd', '20070101'),
'travellerPrioReference' => '0077701F',
'monetaryData' => [
new MonetaryData([
'type' => MonetaryData::TYPE_BASE_FARE,
'amount' => 401.00,
'currency' => 'EUR'
]),
new MonetaryData([
'type' => MonetaryData::TYPE_FARE_USED,
'amount' => 0.00,
'currency' => 'EUR'
]),
new MonetaryData([
'type' => MonetaryData::TYPE_FARE_REFUND,
'amount' => 401.00,
'currency' => 'EUR'
]),
new MonetaryData([
'type' => MonetaryData::TYPE_REFUND_TOTAL,
'amount' => 457.74,
'currency' => 'EUR'
]),
new MonetaryData([
'type' => MonetaryData::TYPE_TOTAL_TAXES,
'amount' => 56.74,
'currency' => 'EUR'
]),
new MonetaryData([
'type' => 'TP',
'amount' => 56.74,
'currency' => 'EUR'
]),
new MonetaryData([
'type' => 'OBP',
'amount' => 0.00,
'currency' => 'EUR'
]),
new MonetaryData([
'type' => 'TGV',
'amount' => 374.93,
'currency' => 'EUR'
])
],
'taxData' => [
new TaxData([
'category' => 'H',
'rate' => 16.14,
'currencyCode' => 'EUR',
'type' => 'DE'
]),
new TaxData([
'category' => 'H',
'rate' => 3.45,
'currencyCode' => 'EUR',
'type' => 'YC'
]),
new TaxData([
'category' => 'H',
'rate' => 9.67,
'currencyCode' => 'EUR',
'type' => 'US'
]),
new TaxData([
'category' => 'H',
'rate' => 9.67,
'currencyCode' => 'EUR',
'type' => 'US'
]),
new TaxData([
'category' => 'H',
'rate' => 3.14,
'currencyCode' => 'EUR',
'type' => 'XA'
]),
new TaxData([
'category' => 'H',
'rate' => 4.39,
'currencyCode' => 'EUR',
'type' => 'XY'
]),
new TaxData([
'category' => 'H',
'rate' => 6.28,
'currencyCode' => 'EUR',
'type' => 'AY'
]),
new TaxData([
'category' => 'H',
'rate' => 4.00,
'currencyCode' => 'EUR',
'type' => 'DU'
]),
new TaxData([
'category' => '701',
'rate' => 56.74,
'currencyCode' => 'EUR',
'type' => TaxData::TYPE_EXTENDED_TAXES
])
],
'formOfPayment' => [
new FopOpt([
'fopType' => FopOpt::TYPE_MISCELLANEOUS,
'fopAmount' => 457.74,
'freeText' => [
new FreeTextOpt([
'type' => 'CFP',
'freeText' => '##0##'
]),
new FreeTextOpt([
'type' => 'CFP',
'freeText' => 'IDBANK'
])
]
])
],
'refundedRouteStations' => [
'FRA',
'MUC',
'JFK',
'BKK',
'FRA'
]
])
);

*******
Service
*******
Expand Down Expand Up @@ -2470,3 +2671,4 @@ Request a sales report from a certain date to another date, issued in all office

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


16 changes: 16 additions & 0 deletions src/Amadeus/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -983,6 +983,22 @@ public function docRefundInitRefund(
return $this->callMessage($msgName, $options, $messageOptions);
}

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

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

/**
* FOP_CreateFormOfPayment
*
Expand Down
10 changes: 0 additions & 10 deletions src/Amadeus/Client/RequestCreator/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,7 @@
use Amadeus\Client\InvalidMessageException;
use Amadeus\Client\Params\RequestCreatorParams;
use Amadeus\Client\RequestCreator\Converter\ConvertInterface;
use Amadeus\Client\RequestOptions\CommandCrypticOptions;
use Amadeus\Client\RequestOptions\DocIssuanceIssueMiscDocOptions;
use Amadeus\Client\RequestOptions\DocIssuanceIssueTicketOptions;
use Amadeus\Client\RequestOptions\InfoEncodeDecodeCityOptions;
use Amadeus\Client\RequestOptions\MiniRuleGetFromPricingOptions;
use Amadeus\Client\RequestOptions\MiniRuleGetFromPricingRecOptions;
use Amadeus\Client\RequestOptions\PriceXplorerExtremeSearchOptions;
use Amadeus\Client\RequestOptions\RequestOptionsInterface;
use Amadeus\Client\RequestOptions\SalesReportsDisplayQueryReportOptions;
use Amadeus\Client\RequestOptions\SecurityAuthenticateOptions;
use Amadeus\Client\RequestOptions\ServiceIntegratedPricingOptions;
use Amadeus\Client\Struct;

/**
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\DocRefund;

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

/**
* DocRefund_UpdateRefund request converter
*
* @package Amadeus\Client\RequestCreator\Converter\DocRefund
* @author Dieter Devlieghere <dieter.devlieghere@benelux.amadeus.com>
*/
class UpdateRefundConv extends BaseConverter
{
/**
* @param DocRefundUpdateRefundOptions $requestOptions
* @param int|string $version
* @return Struct\DocRefund\UpdateRefund
*/
public function convert($requestOptions, $version)
{
return new Struct\DocRefund\UpdateRefund($requestOptions);
}
}
Loading