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 3, 2016
2 parents 86a1d11 + 3b75f01 commit 3ea5c95
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/Amadeus/Client/RequestOptions/Pnr/Segment.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ class Segment extends LoadParamsFromArray
*/
public $status = self::STATUS_CONFIRMED;

/**
* How many travellers?
*
* @var int
*/
public $quantity = 1;

/**
* The company code
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ protected function loadMiscellaneous(Segment\Miscellaneous $segment)
);
$this->messageAction = new MessageAction(Business::FUNC_MISC);

$this->relatedProduct = new RelatedProduct($segment->status);
$this->relatedProduct = new RelatedProduct($segment->status, $segment->quantity);

$this->freetextItinerary = new FreetextItinerary($segment->freeText);
}
Expand Down
42 changes: 42 additions & 0 deletions tests/Amadeus/Client/Struct/Pnr/AddMultiElementsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -628,4 +628,46 @@ public function testCanCreatePnrWithChild()
$this->assertEquals('31012010', $requestStruct->travellerInfo[0]->passengerData[0]->dateOfBirth->dateAndTimeDetails->date);
$this->assertEquals('CHD', $requestStruct->travellerInfo[0]->passengerData[0]->travellerInformation->passenger[0]->type);
}

public function testCanCreateSegmentWithMultiPassengerAssociation()
{
$createPnrOptions = new PnrCreatePnrOptions();
$createPnrOptions->receivedFrom = "unittest";
$createPnrOptions->travellers[] = new Traveller([
'number' => 1,
'lastName' => 'Bowie',
'firstName' => 'David'
]);
$createPnrOptions->travellers[] = new Traveller([
'number' => 2,
'lastName' => 'Bowie',
'firstName' => 'David2'
]);
$createPnrOptions->actionCode = PnrActions::ACTIONOPTION_END_TRANSACT_W_RETRIEVE;
$createPnrOptions->tripSegments[] = new Miscellaneous([
'date' => \DateTime::createFromFormat('Y-m-d', "2016-10-02", new \DateTimeZone('UTC')),
'cityCode' => 'BRU',
'freeText' => 'GENERIC TRAVEL REQUEST',
'quantity' => 2,
'company' => '1A',
'references' => [
new Reference([
'type' => Reference::TYPE_PASSENGER_TATOO,
'id' => 1
]),
new Reference([
'type' => Reference::TYPE_PASSENGER_TATOO,
'id' => 2
])
]
]);

$requestStruct = new AddMultiElements($createPnrOptions);

$this->assertEquals(2, $requestStruct->originDestinationDetails[0]->itineraryInfo[0]->airAuxItinerary->relatedProduct->quantity);
$this->assertEquals('PT', $requestStruct->originDestinationDetails[0]->itineraryInfo[0]->referenceForSegment->reference[0]->qualifier);
$this->assertEquals(1, $requestStruct->originDestinationDetails[0]->itineraryInfo[0]->referenceForSegment->reference[0]->number);
$this->assertEquals('PT', $requestStruct->originDestinationDetails[0]->itineraryInfo[0]->referenceForSegment->reference[1]->qualifier);
$this->assertEquals(2, $requestStruct->originDestinationDetails[0]->itineraryInfo[0]->referenceForSegment->reference[1]->number);
}
}

0 comments on commit 3ea5c95

Please sign in to comment.