Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
DerMika committed Mar 24, 2016
2 parents b048374 + cc58a92 commit 1c7a100
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The Amadeus documentation portal can be found at https://webservices.amadeus.com
Install amadeus-ws-client through [Composer](http://getcomposer.org).

```bash
composer require amabnl/amadeus-ws-client
composer require amabnl/amadeus-ws-client:dev-master
```

After installing, you need to require Composer's autoloader:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ class OfferConfirmHotelOptions extends Base
*/
public $passengers = [];

/**
* The Originator Identifier
*
* @var string
*/
public $originatorId;

/**
* self::PAYMENT_*
*
Expand Down
15 changes: 14 additions & 1 deletion src/Amadeus/Client/Struct/Offer/ConfirmHotel.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
use Amadeus\Client\RequestOptions\Offer\PaymentDetails as PaymentDetailsOptions;
use Amadeus\Client\Struct\BaseWsMessage;
use Amadeus\Client\Struct\InvalidArgumentException;
use Amadeus\Client\Struct\Offer\ConfirmHotel\BookingSource;
use Amadeus\Client\Struct\Offer\ConfirmHotel\GlobalBookingInfo;
use Amadeus\Client\Struct\Offer\ConfirmHotel\GroupCreditCardInfo;
use Amadeus\Client\Struct\Offer\ConfirmHotel\GuaranteeOrDeposit;
Expand Down Expand Up @@ -98,12 +99,24 @@ public function __construct(OfferConfirmHotelOptions $params)
$tmp = new RepresentativeParties();
$tmp->occupantList = new OccupantList(
$singlePass,
PassengerReference::TYPE_BOOKING_HOLDER_OCCUPANT
PassengerReference::TYPE_PAXREF
);
$this->roomStayData[0]->globalBookingInfo->representativeParties[] = $tmp;
}
}

if (!empty($params->originatorId)) {
if (!isset($this->roomStayData[0])) {
$this->roomStayData[] = new RoomStayData();
}

if(!($this->roomStayData[0]->globalBookingInfo instanceof GlobalBookingInfo)) {
$this->roomStayData[0]->globalBookingInfo = new GlobalBookingInfo();
}

$this->roomStayData[0]->globalBookingInfo->bookingSource = new BookingSource($params->originatorId);
}

if (!empty($params->paymentType) && !empty($params->formOfPayment) && $params->paymentDetails instanceof PaymentDetailsOptions) {
if (!isset($this->roomStayData[0])) {
$this->roomStayData[] = new RoomStayData();
Expand Down
2 changes: 1 addition & 1 deletion src/Amadeus/Client/Struct/Offer/ConfirmHotel/RoomList.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@ class RoomList
*/
public function __construct()
{
$this->roomRateDetails = new RoomRateDetails();
//$this->roomRateDetails = new RoomRateDetails();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,13 @@ class TattooReference
/**
* TattooReference constructor.
*
* @param $number
* @param int $number
* @param string $qualifier
* @param string $segName
*/
public function __construct($number, $qualifier = Reference::QUAL_OFFER_TATTOO)
public function __construct($number, $qualifier = Reference::QUAL_OFFER_TATTOO, $segName = self::SEGMENT_NAME_HOTEL_AUX)
{
$this->reference = new Reference($number, $qualifier);
$this->segmentName = $segName;
}
}
11 changes: 9 additions & 2 deletions tests/Amadeus/Client/Struct/Offer/ConfirmHotelOfferTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public function testCanConfirmHotelOfferFullOption()
'recordLocator' => 'ABC123',
'offerReference' => 2,
'passengers' => [1],
'originatorId' => '123456',
'paymentType' => OfferConfirmHotelOptions::PAYMENT_GUARANTEED,
'formOfPayment' => OfferConfirmHotelOptions::FOP_CREDIT_CARD,
'paymentDetails' => new PaymentDetails([
Expand All @@ -56,13 +57,19 @@ public function testCanConfirmHotelOfferFullOption()

$this->assertEquals('ABC123', $msg->pnrInfo->reservation->controlNumber);
$this->assertEquals(ConfirmHotel\Reservation::CONTROLTYPE_PNR_IDENTIFICATION, $msg->pnrInfo->reservation->controlType);

$this->assertEquals(1, count($msg->roomStayData));
$this->assertEquals(2, $msg->roomStayData[0]->tattooReference->reference->number);
$this->assertEquals(ConfirmHotel\TattooReference::SEGMENT_NAME_HOTEL_AUX, $msg->roomStayData[0]->tattooReference->segmentName);
$this->assertEquals(ConfirmHotel\Reference::QUAL_OFFER_TATTOO, $msg->roomStayData[0]->tattooReference->reference->qualifier);

$this->assertEquals(PassengerReference::TYPE_BOOKING_HOLDER_OCCUPANT, $msg->roomStayData[0]->globalBookingInfo->representativeParties[0]->occupantList->passengerReference->type);
$this->assertEquals(PassengerReference::TYPE_PAXREF, $msg->roomStayData[0]->globalBookingInfo->representativeParties[0]->occupantList->passengerReference->type);
$this->assertEquals(1, $msg->roomStayData[0]->globalBookingInfo->representativeParties[0]->occupantList->passengerReference->value);

$this->assertEquals(ConfirmHotel\ReferenceDetails::TYPE_BOOKING_CODE, $msg->roomStayData[0]->roomList[0]->roomRateDetails->hotelProductReference[0]->referenceDetails->type);
$this->assertEquals('123456', $msg->roomStayData[0]->globalBookingInfo->bookingSource->originIdentification->originatorId);

//$this->assertEquals(ConfirmHotel\ReferenceDetails::TYPE_BOOKING_CODE, $msg->roomStayData[0]->roomList[0]->roomRateDetails->hotelProductReference[0]->referenceDetails->type);
$this->assertNull($msg->roomStayData[0]->roomList[0]->roomRateDetails);

$this->assertEquals(ConfirmHotel\PaymentDetails::FOP_CREDIT_CARD, $msg->roomStayData[0]->roomList[0]->guaranteeOrDeposit->paymentInfo->paymentDetails->formOfPaymentCode);
$this->assertEquals(ConfirmHotel\PaymentDetails::PAYMENT_GUARANTEED, $msg->roomStayData[0]->roomList[0]->guaranteeOrDeposit->paymentInfo->paymentDetails->paymentType);
Expand Down

0 comments on commit 1c7a100

Please sign in to comment.