Skip to content

Commit

Permalink
Only provide timeQualifier when a time has been specified in a Fare_M…
Browse files Browse the repository at this point in the history
…asterPricerTravelBoard request (issue #20)
  • Loading branch information
DerMika committed Sep 22, 2016
1 parent 994f25f commit 6421a38
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 20 deletions.
4 changes: 2 additions & 2 deletions docs/samples/masterpricertravelboard.rst
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ Do a ticketability pre-check on recommendations:
'doTicketabilityPreCheck' => true
]);
Paris to Seattle, _arrive_ in Seattle on 13 June 2017 at 18:30 (+/- 6 hours)
Paris to Seattle, *arrive* in Seattle on 13 June 2017 at 18:30 (+/- 6 hours)

.. code-block:: php
Expand Down Expand Up @@ -338,4 +338,4 @@ Simple flight, set "price to beat" at 500 EURO: Recommendations returned must be
],
'priceToBeat' => 500,
'priceToBeatCurrency' => 'EUR',
]);
]);
12 changes: 6 additions & 6 deletions src/Amadeus/Client/Struct/Fare/MasterPricer/TimeDetails.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,18 @@ public function __construct(MPDate $theDate)
$timeString = $this->makeTimeString($theDate->dateTime, $theDate->time);
if ($timeString !== '0000') {
$this->firstDateTimeDetail->time = $timeString;

if ($theDate->isDeparture) {
$this->firstDateTimeDetail->timeQualifier = FirstDateTimeDetail::TIMEQUAL_DEPART_FROM;
} else {
$this->firstDateTimeDetail->timeQualifier = FirstDateTimeDetail::TIMEQUAL_ARRIVAL_BY;
}
}

if (is_int($theDate->timeWindow)) {
$this->firstDateTimeDetail->timeWindow = $theDate->timeWindow;
}

if ($theDate->isDeparture) {
$this->firstDateTimeDetail->timeQualifier = FirstDateTimeDetail::TIMEQUAL_DEPART_FROM;
} else {
$this->firstDateTimeDetail->timeQualifier = FirstDateTimeDetail::TIMEQUAL_ARRIVAL_BY;
}

if (!is_null($theDate->range) && !is_null($theDate->rangeMode)) {
$this->rangeOfDate = new RangeOfDate(
$theDate->rangeMode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,24 @@
*/
class DiscountPenaltyDetails
{
const FUNCTION_BASE_FARE = 700;
const FUNCTION_TOTAL_FARE = 701;
const FUNCTION_PENALTIES_APPLY = 704;
const FUNCTION_EXCLUDE_FEE = "EXF";
const FUNCTION_INCLUDE_FEE = "INF";

const AMOUNTTYPE_FIXED_WHOLE_AMOUNT = 707;
const AMOUNTTYPE_PERCENTAGE = 708;

/**
* 700 Base fare
* 701 Total fare
* 704 Penalties apply
* EXF EXclude Fee
* INF INclude Fee
* self::FUNCTION_*
*
* @var string
*/
public $function;

/**
* 707 Fixed whole amount
* 708 Percentage
* self::AMOUNTTYPE_*
*
* @var string
*/
Expand Down
10 changes: 6 additions & 4 deletions src/Amadeus/Client/Struct/Fare/PricePnr13/PenDisInformation.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@
*/
class PenDisInformation
{
const QUAL_PENALTY = 700;
const QUAL_DISCOUNT = 701;
const QUAL_OB_FEES = "OBF";
const QUAL_ZAPOFF_DISCOUNT = "ZAP";

/**
* 700 Penalty information
* 701 Discount information
* OBF OB Fees Information
* ZAP ZapOff Discount Information
* self::QUAL_*
*
* @var string
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function testCanMakeBaseMasterPricerMessage()
$this->assertInstanceOf('Amadeus\Client\Struct\Fare\MasterPricer\FirstDateTimeDetail', $message->itinerary[0]->timeDetails->firstDateTimeDetail);
$this->assertEquals('150117', $message->itinerary[0]->timeDetails->firstDateTimeDetail->date);
$this->assertNull($message->itinerary[0]->timeDetails->firstDateTimeDetail->time);
$this->assertEquals(FirstDateTimeDetail::TIMEQUAL_DEPART_FROM, $message->itinerary[0]->timeDetails->firstDateTimeDetail->timeQualifier);
$this->assertNull($message->itinerary[0]->timeDetails->firstDateTimeDetail->timeQualifier);
$this->assertEquals('BRU', $message->itinerary[0]->departureLocalization->departurePoint->locationId);
$this->assertEquals('C', $message->itinerary[0]->departureLocalization->departurePoint->airportCityQualifier);
$this->assertEquals('LON', $message->itinerary[0]->arrivalLocalization->arrivalPointDetails->locationId);
Expand Down

0 comments on commit 6421a38

Please sign in to comment.