1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* amadeus-ws-client |
4
|
|
|
* |
5
|
|
|
* Copyright 2015 Amadeus Benelux NV |
6
|
|
|
* |
7
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
8
|
|
|
* you may not use this file except in compliance with the License. |
9
|
|
|
* You may obtain a copy of the License at |
10
|
|
|
* |
11
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0 |
12
|
|
|
* |
13
|
|
|
* Unless required by applicable law or agreed to in writing, software |
14
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, |
15
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
16
|
|
|
* See the License for the specific language governing permissions and |
17
|
|
|
* limitations under the License. |
18
|
|
|
* |
19
|
|
|
* @package Amadeus |
20
|
|
|
* @license https://opensource.org/licenses/Apache-2.0 Apache 2.0 |
21
|
|
|
*/ |
22
|
|
|
|
23
|
|
|
namespace Amadeus\Client\Struct\Fare; |
24
|
|
|
|
25
|
|
|
use Amadeus\Client\RequestOptions\Fare\MPPassenger; |
26
|
|
|
use Amadeus\Client\RequestOptions\FareMasterPricerCalendarOptions; |
27
|
|
|
use Amadeus\Client\RequestOptions\FareMasterPricerTbSearch; |
28
|
|
|
use Amadeus\Client\RequestOptions\TicketCheckEligibilityOptions; |
29
|
|
|
use Amadeus\Client\RequestOptions\Fare\MasterPricer\MultiTicketWeights; |
30
|
|
|
use Amadeus\Client\Struct\BaseWsMessage; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* BaseMasterPricerMessage |
34
|
|
|
* |
35
|
|
|
* @package Amadeus\Client\Struct\Fare |
36
|
|
|
* @author Dieter Devlieghere <[email protected]> |
37
|
|
|
*/ |
38
|
|
|
class BaseMasterPricerMessage extends BaseWsMessage |
39
|
|
|
{ |
40
|
|
|
/** |
41
|
|
|
* Number of seats, recommendations. |
42
|
|
|
* |
43
|
|
|
* @var MasterPricer\NumberOfUnit |
44
|
|
|
*/ |
45
|
|
|
public $numberOfUnit; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* Traveler Details |
49
|
|
|
* |
50
|
|
|
* @var MasterPricer\PaxReference[] |
51
|
|
|
*/ |
52
|
|
|
public $paxReference = []; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @var MasterPricer\FareOptions |
56
|
|
|
*/ |
57
|
|
|
public $fareOptions; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @var array |
61
|
|
|
*/ |
62
|
|
|
public $buckets = []; |
63
|
|
|
|
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @param MPPassenger $passenger |
67
|
|
|
* @param int $counter BYREF |
68
|
|
|
* @param int $infantCounter BYREF |
69
|
|
|
*/ |
70
|
350 |
|
protected function loadPassenger($passenger, &$counter, &$infantCounter) |
71
|
|
|
{ |
72
|
350 |
|
$isInfant = ($passenger->type === 'INF'); |
73
|
|
|
|
74
|
350 |
|
$paxRef = new MasterPricer\PaxReference( |
75
|
350 |
|
$isInfant ? $infantCounter : $counter, |
76
|
280 |
|
$isInfant, |
77
|
350 |
|
$passenger->type |
78
|
140 |
|
); |
79
|
|
|
|
80
|
350 |
|
if ($isInfant) { |
81
|
10 |
|
$infantCounter++; |
82
|
4 |
|
} else { |
83
|
350 |
|
$counter++; |
84
|
|
|
} |
85
|
|
|
|
86
|
350 |
|
if ($passenger->count > 1) { |
87
|
20 |
|
for ($i = 2; $i <= $passenger->count; $i++) { |
88
|
20 |
|
$tmpCount = ($isInfant) ? $infantCounter : $counter; |
89
|
20 |
|
$paxRef->traveller[] = new MasterPricer\Traveller($tmpCount, $isInfant); |
90
|
|
|
|
91
|
20 |
|
if ($isInfant) { |
92
|
10 |
|
$infantCounter++; |
93
|
4 |
|
} else { |
94
|
20 |
|
$counter++; |
95
|
|
|
} |
96
|
8 |
|
} |
97
|
8 |
|
} |
98
|
|
|
|
99
|
350 |
|
$this->paxReference[] = $paxRef; |
100
|
350 |
|
} |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* @param FareMasterPricerTbSearch|FareMasterPricerCalendarOptions|TicketCheckEligibilityOptions $options |
104
|
|
|
* @return void |
105
|
|
|
*/ |
106
|
385 |
|
protected function loadNumberOfUnits($options) |
107
|
|
|
{ |
108
|
385 |
|
if (is_int($options->nrOfRequestedPassengers) || |
109
|
25 |
|
is_int($options->nrOfRequestedResults) || |
110
|
241 |
|
$options->multiTicketWeights !== null |
111
|
154 |
|
) { |
112
|
360 |
|
$this->numberOfUnit = new MasterPricer\NumberOfUnit( |
113
|
360 |
|
$options->nrOfRequestedPassengers, |
114
|
360 |
|
$options->nrOfRequestedResults, |
115
|
360 |
|
$options->multiTicketWeights, |
116
|
144 |
|
$options->ndcOnly |
117
|
144 |
|
); |
118
|
385 |
|
} |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* @param FareMasterPricerTbSearch|FareMasterPricerCalendarOptions|TicketCheckEligibilityOptions $options |
123
|
385 |
|
*/ |
124
|
|
|
protected function loadFareOptions($options) |
125
|
385 |
|
{ |
126
|
375 |
|
if ($options->doTicketabilityPreCheck === true || |
127
|
375 |
|
$this->checkAnyNotEmpty( |
128
|
375 |
|
$options->corporateCodesUnifares, |
129
|
375 |
|
$options->flightOptions, |
130
|
375 |
|
$options->currencyOverride, |
131
|
375 |
|
$options->feeIds, |
132
|
375 |
|
$options->multiTicket, |
133
|
381 |
|
$options->ticketingPriceScheme, |
134
|
150 |
|
$options->formOfPayment |
135
|
154 |
|
) |
136
|
110 |
|
) { |
137
|
110 |
|
$this->fareOptions = new MasterPricer\FareOptions( |
138
|
110 |
|
$options->flightOptions, |
139
|
110 |
|
$options->corporateCodesUnifares, |
140
|
110 |
|
$options->doTicketabilityPreCheck, |
141
|
110 |
|
$options->currencyOverride, |
142
|
110 |
|
$options->feeIds, |
143
|
110 |
|
$options->corporateQualifier, |
144
|
110 |
|
$options->multiTicket, |
145
|
110 |
|
$options->ticketingPriceScheme, |
146
|
44 |
|
$options->formOfPayment |
147
|
44 |
|
); |
148
|
385 |
|
} |
149
|
|
|
} |
150
|
|
|
} |
151
|
|
|
|