Skip to content

Commit

Permalink
PNR_AddMultiElements support for Address & Accounting Information ele…
Browse files Browse the repository at this point in the history
…ments
  • Loading branch information
DerMika committed Feb 26, 2016
1 parent 4cb7125 commit e14d5bb
Show file tree
Hide file tree
Showing 14 changed files with 621 additions and 8 deletions.
61 changes: 61 additions & 0 deletions src/Amadeus/Client/RequestOptions/Pnr/Element/AccountingInfo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?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\Pnr\Element;

use Amadeus\Client\RequestOptions\Pnr\Element;

/**
* AccountingInfo
*
* @package Amadeus\Client\RequestOptions\Pnr\Element
*/
class AccountingInfo extends Element
{
/**
* Account Number
*
* @var string
*/
public $accountNumber;

/**
* Cost Center Number
*
* @var string
*/
public $costCenter;

/**
* Company ID Number
*
* @var string
*/
public $companyIdNumber;

/**
* Client Reference Number
*
* @var string
*/
public $clientRefNumber;
}
100 changes: 100 additions & 0 deletions src/Amadeus/Client/RequestOptions/Pnr/Element/Address.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<?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\Pnr\Element;

/**
* Address
*
* Billing address, Mailing address, structured or unstructured
*
* @package Amadeus\Client\RequestOptions\Pnr\Element
*/
class Address
{
const TYPE_BILLING_UNSTRUCTURED = "ABU";

const TYPE_MAILING_UNSTRUCTURED = "AMU";

const TYPE_BILLING_STRUCTURED = "AB";

const TYPE_MAILING_STRUCTURED = "AM";

/**
* self::TYPE_*
*
* @var string
*/
public $type;

/**
* The entire address as unstructured text (use comma's for newlines)
*
* ONLY FOR UNSTRUCTURED ADDRESSES
*
* @var string
*/
public $freeText;

/**
* Name - for structured address
*
* @var string
*/
public $name;
/**
* Address line 1 - for structured address
*
* @var string
*/
public $addressLine1;
/**
* Address line 2 - for structured address
*
* @var string
*/
public $addressLine2;
/**
* City - for structured address
*
* @var string
*/
public $city;
/**
* State - for structured address
*
* @var string
*/
public $state;
/**
* Zip Code - for structured address
*
* @var string
*/
public $zipCode;
/**
* Country - for structured address
*
* @var string
*/
public $country;
}
18 changes: 17 additions & 1 deletion src/Amadeus/Client/Struct/Pnr/AddMultiElements.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
use Amadeus\Client\RequestOptions\RequestOptionsInterface;
use Amadeus\Client\Struct\BaseWsMessage;
use Amadeus\Client\Struct\InvalidArgumentException;
use Amadeus\Client\Struct\Pnr\AddMultiElements\Accounting;
use Amadeus\Client\Struct\Pnr\AddMultiElements\AirAuxItinerary;
use Amadeus\Client\Struct\Pnr\AddMultiElements\DataElementsIndiv;
use Amadeus\Client\Struct\Pnr\AddMultiElements\DataElementsMaster;
Expand All @@ -54,6 +55,7 @@
use Amadeus\Client\Struct\Pnr\AddMultiElements\PassengerData;
use Amadeus\Client\Struct\Pnr\AddMultiElements\ReferenceForDataElement;
use Amadeus\Client\Struct\Pnr\AddMultiElements\ServiceRequest;
use Amadeus\Client\Struct\Pnr\AddMultiElements\StructuredAddress;
use Amadeus\Client\Struct\Pnr\AddMultiElements\TicketElement;
use Amadeus\Client\Struct\Pnr\AddMultiElements\TravellerInfo;

Expand Down Expand Up @@ -343,7 +345,7 @@ protected function createElement($element, &$tatooCounter)
break;
case 'ReceivedFrom':
/** @var Element\ReceivedFrom $element */
$createdElement = new DataElementsIndiv(ElementManagementData::SEGNAME_RECEIVE_FROM);
$createdElement = new DataElementsIndiv(ElementManagementData::SEGNAME_RECEIVE_FROM, $tatooCounter);
$createdElement->freetextData = new FreetextData(
$element->receivedFrom,
FreetextDetail::TYPE_RECEIVE_FROM
Expand All @@ -359,6 +361,20 @@ protected function createElement($element, &$tatooCounter)
$createdElement = new DataElementsIndiv(ElementManagementData::SEGNAME_TICKETING_ELEMENT, $tatooCounter);
$createdElement->ticketElement = new TicketElement($element);
break;
case 'AccountingInfo':
/** @var Element\AccountingInfo $element */
$createdElement = new DataElementsIndiv(ElementManagementData::SEGNAME_ACCOUNTING_INFORMATION, $tatooCounter);
$createdElement->accounting = new Accounting($element);
break;
case 'Address':
/** @var Element\Address $element */
$createdElement = new DataElementsIndiv($element->type, $tatooCounter);
if ($element->type === ElementManagementData::SEGNAME_ADDRESS_BILLING_UNSTRUCTURED || ElementManagementData::SEGNAME_ADDRESS_MAILING_UNSTRUCTURED) {
$createdElement->freetextData = new FreetextData($element->freeText, FreetextDetail::TYPE_MAILING_ADDRESS);
} else {
$createdElement->structuredAddress = new StructuredAddress($element);
}
break;
default:
throw new InvalidArgumentException('Element type ' . $elementType . 'is not supported');
}
Expand Down
66 changes: 66 additions & 0 deletions src/Amadeus/Client/Struct/Pnr/AddMultiElements/Account.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?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\Pnr\AddMultiElements;

/**
* Account
*
* @package Amadeus\Client\Struct\Pnr\AddMultiElements
*/
class Account
{
/**
* @var string
*/
public $number;

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

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

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

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

/**
* Account constructor.
*
* @param null $number
*/
public function __construct($number = null)
{
$this->number = $number;
}
}
56 changes: 56 additions & 0 deletions src/Amadeus/Client/Struct/Pnr/AddMultiElements/Accounting.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?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\Pnr\AddMultiElements;

use Amadeus\Client\RequestOptions\Pnr\Element\AccountingInfo;

/**
* Accounting
*
* @package Amadeus\Client\Struct\Pnr\AddMultiElements
*/
class Accounting
{
/**
* @var Account
*/
public $account;

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

/**
* Accounting constructor.
*
* @param AccountingInfo $params
*/
public function __construct(AccountingInfo $params)
{
$this->account = new Account($params->accountNumber);
$this->account->costNumber = $params->costCenter;
$this->account->clientReference = $params->clientRefNumber;
$this->account->companyNumber = $params->companyIdNumber;
}
}
65 changes: 65 additions & 0 deletions src/Amadeus/Client/Struct/Pnr/AddMultiElements/Address.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?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\Pnr\AddMultiElements;

/**
* Address
*
* @package Amadeus\Client\Struct\Pnr\AddMultiElements
* @author Dieter Devlieghere <dieter.devlieghere@benelux.amadeus.com>
*/
class Address
{
const OPT_ADDRESS_LINE_1 = "A1";


/**
* A1 Address line1
* A2 Address line 2
* CI City
* CO Country
* CY Company
* NA Name
* PO P.O. BOX
* ST State
* ZP Postal code
*
* @var string
*/
public $optionA1 = self::OPT_ADDRESS_LINE_1;

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

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

0 comments on commit e14d5bb

Please sign in to comment.