|
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\RequestCreator\MessageVersionUnsupportedException; |
|
26
|
|
|
use Amadeus\Client\RequestOptions\Fare\PricePnr\AwardPricing; |
|
27
|
|
|
use Amadeus\Client\RequestOptions\Fare\PricePnr\ExemptTax; |
|
28
|
|
|
use Amadeus\Client\RequestOptions\Fare\PricePnr\FareBasis; |
|
29
|
|
|
use Amadeus\Client\RequestOptions\Fare\PricePnr\ObFee; |
|
30
|
|
|
use Amadeus\Client\RequestOptions\Fare\PricePnr\PaxSegRef; |
|
31
|
|
|
use Amadeus\Client\RequestOptions\Fare\PricePnr\Tax; |
|
32
|
|
|
use Amadeus\Client\RequestOptions\FarePricePnrWithBookingClassOptions; |
|
33
|
|
|
use Amadeus\Client\Struct\BaseWsMessage; |
|
34
|
|
|
use Amadeus\Client\Struct\Fare\PricePnr13\CarrierInformation; |
|
35
|
|
|
use Amadeus\Client\Struct\Fare\PricePnr13\CriteriaDetails; |
|
36
|
|
|
use Amadeus\Client\Struct\Fare\PricePnr13\Currency; |
|
37
|
|
|
use Amadeus\Client\Struct\Fare\PricePnr13\DateInformation; |
|
38
|
|
|
use Amadeus\Client\Struct\Fare\PricePnr13\DiscountPenaltyDetails; |
|
39
|
|
|
use Amadeus\Client\Struct\Fare\PricePnr13\FirstCurrencyDetails; |
|
40
|
|
|
use Amadeus\Client\Struct\Fare\PricePnr13\FrequentFlyerInformation; |
|
41
|
|
|
use Amadeus\Client\Struct\Fare\PricePnr13\FrequentTravellerDetails; |
|
42
|
|
|
use Amadeus\Client\Struct\Fare\PricePnr13\LocationInformation; |
|
43
|
|
|
use Amadeus\Client\Struct\Fare\PricePnr13\OptionDetail; |
|
44
|
|
|
use Amadeus\Client\Struct\Fare\PricePnr13\PaxSegTstReference; |
|
45
|
|
|
use Amadeus\Client\Struct\Fare\PricePnr13\PenDisInformation; |
|
46
|
|
|
use Amadeus\Client\Struct\Fare\PricePnr13\PricingOptionGroup; |
|
47
|
|
|
use Amadeus\Client\Struct\Fare\PricePnr13\PricingOptionKey; |
|
48
|
|
|
use Amadeus\Client\Struct\Fare\PricePnr13\TaxData; |
|
49
|
|
|
use Amadeus\Client\Struct\Fare\PricePnr13\TaxInformation; |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* Fare_PricePNRWithBookingClass v 13 and higher structure |
|
53
|
|
|
* |
|
54
|
|
|
* @package Amadeus\Client\Struct\Fare |
|
55
|
|
|
* @author dieter <[email protected]> |
|
56
|
|
|
*/ |
|
57
|
|
|
class PricePNRWithBookingClass13 extends BaseWsMessage |
|
58
|
|
|
{ |
|
59
|
|
|
/** |
|
60
|
|
|
* @var PricePnr13\PricingOptionGroup[] |
|
61
|
|
|
*/ |
|
62
|
|
|
public $pricingOptionGroup = []; |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* PricePNRWithBookingClass13 constructor. |
|
66
|
|
|
* |
|
67
|
|
|
* @param FarePricePnrWithBookingClassOptions $options |
|
68
|
|
|
* @throws MessageVersionUnsupportedException |
|
69
|
|
|
*/ |
|
70
|
|
|
public function __construct(FarePricePnrWithBookingClassOptions $options) |
|
71
|
|
|
{ |
|
72
|
|
|
$this->pricingOptionGroup = $this->loadPricingOptionsFromRequestOptions($options); |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
/** |
|
76
|
|
|
* Load an array of PricingOptionGroup objects from the Pricing request options. |
|
77
|
|
|
* |
|
78
|
|
|
* Extracted because this method is also used in the InformativePricingWithoutPnr messages. |
|
79
|
|
|
* |
|
80
|
|
|
* @param FarePricePnrWithBookingClassOptions $options |
|
81
|
|
|
* @return PricingOptionGroup[] |
|
82
|
|
|
*/ |
|
83
|
|
|
public static function loadPricingOptionsFromRequestOptions(FarePricePnrWithBookingClassOptions $options) |
|
84
|
|
|
{ |
|
85
|
|
|
$priceOptions = []; |
|
86
|
|
|
|
|
87
|
|
|
$priceOptions = self::mergeOptions( |
|
88
|
|
|
$priceOptions, |
|
89
|
|
|
self::makePricingOptionForValidatingCarrier($options->validatingCarrier) |
|
90
|
|
|
); |
|
91
|
|
|
|
|
92
|
|
|
$priceOptions = self::mergeOptions( |
|
93
|
|
|
$priceOptions, |
|
94
|
|
|
self::makePricingOptionForCurrencyOverride($options->currencyOverride) |
|
95
|
|
|
); |
|
96
|
|
|
|
|
97
|
|
|
$priceOptions = self::mergeOptions( |
|
98
|
|
|
$priceOptions, |
|
99
|
|
|
self::makePricingOptionFareBasisOverride($options->pricingsFareBasis) |
|
100
|
|
|
); |
|
101
|
|
|
|
|
102
|
|
|
$priceOptions = self::mergeOptions( |
|
103
|
|
|
$priceOptions, |
|
104
|
|
|
self::makeOverrideOptions($options->overrideOptions, $priceOptions) |
|
105
|
|
|
); |
|
106
|
|
|
|
|
107
|
|
|
$priceOptions = self::mergeOptions( |
|
108
|
|
|
$priceOptions, |
|
109
|
|
|
self::loadCorpNegoFare($options->corporateNegoFare) |
|
110
|
|
|
); |
|
111
|
|
|
|
|
112
|
|
|
$priceOptions = self::mergeOptions( |
|
113
|
|
|
$priceOptions, |
|
114
|
|
|
self::loadCorpUniFares($options->corporateUniFares, $options->awardPricing) |
|
115
|
|
|
); |
|
116
|
|
|
|
|
117
|
|
|
$priceOptions = self::mergeOptions( |
|
118
|
|
|
$priceOptions, |
|
119
|
|
|
self::loadObFees($options->obFees, $options->obFeeRefs) |
|
120
|
|
|
); |
|
121
|
|
|
|
|
122
|
|
|
$priceOptions = self::mergeOptions( |
|
123
|
|
|
$priceOptions, |
|
124
|
|
|
self::loadPaxDiscount($options->paxDiscountCodes, $options->paxDiscountCodeRefs) |
|
125
|
|
|
); |
|
126
|
|
|
|
|
127
|
|
|
if (!empty($options->pointOfSaleOverride)) { |
|
128
|
|
|
$priceOptions[] = self::loadPointOfSaleOverride($options->pointOfSaleOverride); |
|
129
|
|
|
} |
|
130
|
|
|
|
|
131
|
|
|
if (!empty($options->pointOfTicketingOverride)) { |
|
132
|
|
|
$priceOptions[] = self::loadPointOfTicketingOverride($options->pointOfTicketingOverride); |
|
133
|
|
|
} |
|
134
|
|
|
|
|
135
|
|
|
if (!empty($options->pricingLogic)) { |
|
136
|
|
|
$priceOptions[] = self::loadPricingLogic($options->pricingLogic); |
|
137
|
|
|
} |
|
138
|
|
|
|
|
139
|
|
|
if (!empty($options->ticketType)) { |
|
140
|
|
|
$priceOptions[] = self::loadTicketType($options->ticketType); |
|
141
|
|
|
} |
|
142
|
|
|
|
|
143
|
|
|
if (!empty($options->taxes)) { |
|
144
|
|
|
$priceOptions[] = self::loadTaxes($options->taxes); |
|
145
|
|
|
} |
|
146
|
|
|
|
|
147
|
|
|
if (!empty($options->exemptTaxes)) { |
|
148
|
|
|
$priceOptions[] = self::loadExemptTaxes($options->exemptTaxes); |
|
149
|
|
|
} |
|
150
|
|
|
|
|
151
|
|
|
if ($options->pastDatePricing instanceof \DateTime) { |
|
152
|
|
|
$priceOptions[] = self::loadPastDate($options->pastDatePricing); |
|
153
|
|
|
} |
|
154
|
|
|
|
|
155
|
|
|
if (!empty($options->references)) { |
|
156
|
|
|
$priceOptions[] = self::loadReferences($options->references); |
|
157
|
|
|
} |
|
158
|
|
|
|
|
159
|
|
|
|
|
160
|
|
|
// All options processed, no options found: |
|
161
|
|
|
if (empty($priceOptions)) { |
|
162
|
|
|
$priceOptions[] = new PricingOptionGroup(PricingOptionKey::OPTION_NO_OPTION); |
|
163
|
|
|
} |
|
164
|
|
|
|
|
165
|
|
|
return $priceOptions; |
|
166
|
|
|
} |
|
167
|
|
|
|
|
168
|
|
|
/** |
|
169
|
|
|
* @param string[] $overrideOptions |
|
170
|
|
|
* @param PricingOptionGroup[] $priceOptions |
|
171
|
|
|
* @return PricingOptionGroup[] |
|
172
|
|
|
*/ |
|
173
|
|
|
protected static function makeOverrideOptions($overrideOptions, $priceOptions) |
|
174
|
|
|
{ |
|
175
|
|
|
$opt = []; |
|
176
|
|
|
|
|
177
|
|
|
if (!empty($overrideOptions)) { |
|
178
|
|
|
foreach ($overrideOptions as $overrideOption) { |
|
179
|
|
|
if (!self::hasPricingGroup($overrideOption, $priceOptions)) { |
|
180
|
|
|
$opt[] = new PricingOptionGroup($overrideOption); |
|
181
|
|
|
} |
|
182
|
|
|
} |
|
183
|
|
|
} |
|
184
|
|
|
|
|
185
|
|
|
return $opt; |
|
186
|
|
|
} |
|
187
|
|
|
|
|
188
|
|
|
/** |
|
189
|
|
|
* @param string|null $validatingCarrier |
|
190
|
|
|
* @return PricePnr13\PricingOptionGroup[] |
|
191
|
|
|
*/ |
|
192
|
|
|
protected static function makePricingOptionForValidatingCarrier($validatingCarrier) |
|
193
|
|
|
{ |
|
194
|
|
|
$opt = []; |
|
195
|
|
|
|
|
196
|
|
|
if ($validatingCarrier !== null) { |
|
197
|
|
|
$po = new PricingOptionGroup(PricingOptionKey::OPTION_VALIDATING_CARRIER); |
|
198
|
|
|
|
|
199
|
|
|
$po->carrierInformation = new CarrierInformation($validatingCarrier); |
|
200
|
|
|
|
|
201
|
|
|
$opt[] = $po; |
|
202
|
|
|
} |
|
203
|
|
|
|
|
204
|
|
|
return $opt; |
|
205
|
|
|
} |
|
206
|
|
|
|
|
207
|
|
|
/** |
|
208
|
|
|
* @param string|null $currency |
|
209
|
|
|
* @return PricePnr13\PricingOptionGroup[] |
|
210
|
|
|
*/ |
|
211
|
|
|
protected static function makePricingOptionForCurrencyOverride($currency) |
|
212
|
|
|
{ |
|
213
|
|
|
$opt = []; |
|
214
|
|
|
|
|
215
|
|
|
if ($currency !== null) { |
|
216
|
|
|
$po = new PricingOptionGroup(PricingOptionKey::OPTION_FARE_CURRENCY_OVERRIDE); |
|
217
|
|
|
|
|
218
|
|
|
$po->currency = new Currency($currency, FirstCurrencyDetails::QUAL_CURRENCY_OVERRIDE); |
|
219
|
|
|
|
|
220
|
|
|
$opt[] = $po; |
|
221
|
|
|
} |
|
222
|
|
|
|
|
223
|
|
|
return $opt; |
|
224
|
|
|
} |
|
225
|
|
|
|
|
226
|
|
|
/** |
|
227
|
|
|
* @param FareBasis[] $pricingsFareBasis |
|
228
|
|
|
* @return PricePnr13\PricingOptionGroup[] |
|
229
|
|
|
*/ |
|
230
|
|
|
protected static function makePricingOptionFareBasisOverride($pricingsFareBasis) |
|
231
|
|
|
{ |
|
232
|
|
|
$opt = []; |
|
233
|
|
|
|
|
234
|
|
|
if ($pricingsFareBasis !== null) { |
|
235
|
|
|
foreach ($pricingsFareBasis as $pricingFareBasis) { |
|
236
|
|
|
$po = new PricingOptionGroup(PricingOptionKey::OPTION_FARE_BASIS_SIMPLE_OVERRIDE); |
|
237
|
|
|
|
|
238
|
|
|
$po->optionDetail = new OptionDetail(); |
|
239
|
|
|
|
|
240
|
|
|
//Support for legacy fareBasisPrimaryCode to be removed when breaking BC: |
|
241
|
|
|
$po->optionDetail->criteriaDetails[] = new CriteriaDetails( |
|
242
|
|
|
$pricingFareBasis->fareBasisPrimaryCode . $pricingFareBasis->fareBasisCode |
|
|
|
|
|
|
243
|
|
|
); |
|
244
|
|
|
|
|
245
|
|
|
//Support for legacy segmentReference to be removed when breaking BC: |
|
246
|
|
|
$po->paxSegTstReference = new PaxSegTstReference( |
|
247
|
|
|
$pricingFareBasis->segmentReference, |
|
|
|
|
|
|
248
|
|
|
$pricingFareBasis->references |
|
249
|
|
|
); |
|
250
|
|
|
|
|
251
|
|
|
$opt[] = $po; |
|
252
|
|
|
} |
|
253
|
|
|
} |
|
254
|
|
|
|
|
255
|
|
|
return $opt; |
|
256
|
|
|
} |
|
257
|
|
|
|
|
258
|
|
|
/** |
|
259
|
|
|
* Load corporate negofare |
|
260
|
|
|
* |
|
261
|
|
|
* @param string|null $corporateNegoFare |
|
262
|
|
|
* @return PricingOptionGroup[] |
|
263
|
|
|
*/ |
|
264
|
|
|
protected static function loadCorpNegoFare($corporateNegoFare) |
|
265
|
|
|
{ |
|
266
|
|
|
$opt = []; |
|
267
|
|
|
|
|
268
|
|
|
if ($corporateNegoFare !== null) { |
|
269
|
|
|
$po = new PricingOptionGroup(PricingOptionKey::OPTION_CORPORATE_NEGOTIATED_FARES); |
|
270
|
|
|
|
|
271
|
|
|
$po->optionDetail = new OptionDetail(); |
|
272
|
|
|
$po->optionDetail->criteriaDetails[] = new CriteriaDetails($corporateNegoFare); |
|
273
|
|
|
|
|
274
|
|
|
$opt[] = $po; |
|
275
|
|
|
} |
|
276
|
|
|
|
|
277
|
|
|
return $opt; |
|
278
|
|
|
} |
|
279
|
|
|
|
|
280
|
|
|
/** |
|
281
|
|
|
* Load corporate unifares |
|
282
|
|
|
* |
|
283
|
|
|
* @param string[] $corporateUniFares |
|
284
|
|
|
* @param AwardPricing|null $awardPricing |
|
285
|
|
|
* @return PricingOptionGroup[] |
|
286
|
|
|
*/ |
|
287
|
|
|
protected static function loadCorpUniFares($corporateUniFares, $awardPricing) |
|
288
|
|
|
{ |
|
289
|
|
|
$opt = []; |
|
290
|
|
|
|
|
291
|
|
|
if (!empty($corporateUniFares)) { |
|
292
|
|
|
$po = new PricingOptionGroup(PricingOptionKey::OPTION_CORPORATE_UNIFARES); |
|
293
|
|
|
|
|
294
|
|
|
$po->optionDetail = new OptionDetail(); |
|
295
|
|
|
|
|
296
|
|
|
foreach ($corporateUniFares as $corporateUniFare) { |
|
297
|
|
|
$po->optionDetail->criteriaDetails[] = new CriteriaDetails($corporateUniFare); |
|
298
|
|
|
} |
|
299
|
|
|
|
|
300
|
|
|
$opt[] = $po; |
|
301
|
|
|
|
|
302
|
|
|
if (!empty($awardPricing)) { |
|
303
|
|
|
$opt[] = self::loadAwardPricing($awardPricing); |
|
304
|
|
|
} |
|
305
|
|
|
} |
|
306
|
|
|
|
|
307
|
|
|
return $opt; |
|
308
|
|
|
} |
|
309
|
|
|
|
|
310
|
|
|
/** |
|
311
|
|
|
* @param AwardPricing $awardPricing |
|
312
|
|
|
* @return PricingOptionGroup |
|
313
|
|
|
*/ |
|
314
|
|
|
protected static function loadAwardPricing($awardPricing) |
|
315
|
|
|
{ |
|
316
|
|
|
$po = new PricingOptionGroup(PricingOptionKey::OPTION_AWARD_PRICING); |
|
317
|
|
|
|
|
318
|
|
|
$po->optionDetail = new OptionDetail(); |
|
319
|
|
|
|
|
320
|
|
|
$po->carrierInformation = new CarrierInformation($awardPricing->carrier); |
|
321
|
|
|
|
|
322
|
|
|
$po->frequentFlyerInformation = new FrequentFlyerInformation(); |
|
323
|
|
|
$po->frequentFlyerInformation->frequentTravellerDetails[] = new FrequentTravellerDetails( |
|
324
|
|
|
$awardPricing->tierLevel |
|
325
|
|
|
); |
|
326
|
|
|
|
|
327
|
|
|
return $po; |
|
328
|
|
|
} |
|
329
|
|
|
|
|
330
|
|
|
/** |
|
331
|
|
|
* Load OB Fees |
|
332
|
|
|
* |
|
333
|
|
|
* @param ObFee[] $obFees |
|
334
|
|
|
* @param PaxSegRef[] $obFeeRefs |
|
335
|
|
|
* @return PricingOptionGroup[] |
|
336
|
|
|
*/ |
|
337
|
|
|
protected static function loadObFees($obFees, $obFeeRefs) |
|
338
|
|
|
{ |
|
339
|
|
|
$opt = []; |
|
340
|
|
|
|
|
341
|
|
|
if (!empty($obFees)) { |
|
342
|
|
|
$po = new PricingOptionGroup(PricingOptionKey::OPTION_OB_FEES); |
|
343
|
|
|
|
|
344
|
|
|
$po->penDisInformation = new PenDisInformation(PenDisInformation::QUAL_OB_FEES); |
|
345
|
|
|
|
|
346
|
|
|
foreach ($obFees as $obFee) { |
|
347
|
|
|
$amountType = (!empty($obFee->amount)) ? |
|
348
|
|
|
DiscountPenaltyDetails::AMOUNTTYPE_FIXED_WHOLE_AMOUNT : |
|
349
|
|
|
DiscountPenaltyDetails::AMOUNTTYPE_PERCENTAGE; |
|
350
|
|
|
|
|
351
|
|
|
$rate = (!empty($obFee->amount)) ? $obFee->amount : $obFee->percentage; |
|
352
|
|
|
|
|
353
|
|
|
$po->penDisInformation->discountPenaltyDetails[] = new DiscountPenaltyDetails( |
|
354
|
|
|
$obFee->rate, |
|
355
|
|
|
self::makeObFeeFunction($obFee->include), |
|
356
|
|
|
$amountType, |
|
357
|
|
|
$rate, |
|
358
|
|
|
$obFee->currency |
|
359
|
|
|
); |
|
360
|
|
|
} |
|
361
|
|
|
|
|
362
|
|
|
if (!empty($obFeeRefs)) { |
|
363
|
|
|
$po->paxSegTstReference = new PaxSegTstReference(null, $obFeeRefs); |
|
364
|
|
|
} |
|
365
|
|
|
|
|
366
|
|
|
$opt[] = $po; |
|
367
|
|
|
} |
|
368
|
|
|
|
|
369
|
|
|
return $opt; |
|
370
|
|
|
} |
|
371
|
|
|
|
|
372
|
|
|
/** |
|
373
|
|
|
* @param string[] $paxDiscount |
|
374
|
|
|
* @param PaxSegRef[] $paxDiscountCodeRefs |
|
375
|
|
|
* @return PricingOptionGroup[] |
|
376
|
|
|
*/ |
|
377
|
|
|
protected static function loadPaxDiscount($paxDiscount, $paxDiscountCodeRefs) |
|
378
|
|
|
{ |
|
379
|
|
|
$opt = []; |
|
380
|
|
|
|
|
381
|
|
|
if (!empty($paxDiscount)) { |
|
382
|
|
|
$po = new PricingOptionGroup(PricingOptionKey::OPTION_PASSENGER_DISCOUNT_PTC); |
|
383
|
|
|
|
|
384
|
|
|
$po->penDisInformation = new PenDisInformation(PenDisInformation::QUAL_DISCOUNT); |
|
385
|
|
|
|
|
386
|
|
|
foreach ($paxDiscount as $discount) { |
|
387
|
|
|
$po->penDisInformation->discountPenaltyDetails[] = new DiscountPenaltyDetails($discount); |
|
388
|
|
|
} |
|
389
|
|
|
|
|
390
|
|
|
if (!empty($paxDiscountCodeRefs)) { |
|
391
|
|
|
$po->paxSegTstReference = new PaxSegTstReference(null, $paxDiscountCodeRefs); |
|
392
|
|
|
} |
|
393
|
|
|
|
|
394
|
|
|
$opt[] = $po; |
|
395
|
|
|
} |
|
396
|
|
|
|
|
397
|
|
|
return $opt; |
|
398
|
|
|
} |
|
399
|
|
|
|
|
400
|
|
|
/** |
|
401
|
|
|
* @param string $posOverride |
|
402
|
|
|
* @return PricingOptionGroup |
|
403
|
|
|
*/ |
|
404
|
|
View Code Duplication |
protected static function loadPointOfSaleOverride($posOverride) |
|
|
|
|
|
|
405
|
|
|
{ |
|
406
|
|
|
$po = new PricingOptionGroup(PricingOptionKey::OPTION_POINT_OF_SALE_OVERRIDE); |
|
407
|
|
|
|
|
408
|
|
|
$po->locationInformation = new LocationInformation( |
|
409
|
|
|
LocationInformation::TYPE_POINT_OF_SALE, |
|
410
|
|
|
$posOverride |
|
411
|
|
|
); |
|
412
|
|
|
|
|
413
|
|
|
return $po; |
|
414
|
|
|
} |
|
415
|
|
|
|
|
416
|
|
|
/** |
|
417
|
|
|
* @param string $potOverride |
|
418
|
|
|
* @return PricingOptionGroup |
|
419
|
|
|
*/ |
|
420
|
|
View Code Duplication |
protected static function loadPointOfTicketingOverride($potOverride) |
|
|
|
|
|
|
421
|
|
|
{ |
|
422
|
|
|
$po = new PricingOptionGroup(PricingOptionKey::OPTION_POINT_OF_TICKETING_OVERRIDE); |
|
423
|
|
|
|
|
424
|
|
|
$po->locationInformation = new LocationInformation( |
|
425
|
|
|
LocationInformation::TYPE_POINT_OF_TICKETING, |
|
426
|
|
|
$potOverride |
|
427
|
|
|
); |
|
428
|
|
|
|
|
429
|
|
|
return $po; |
|
430
|
|
|
} |
|
431
|
|
|
|
|
432
|
|
|
/** |
|
433
|
|
|
* @param string $pricingLogic |
|
434
|
|
|
* @return PricingOptionGroup |
|
435
|
|
|
*/ |
|
436
|
|
View Code Duplication |
protected static function loadPricingLogic($pricingLogic) |
|
|
|
|
|
|
437
|
|
|
{ |
|
438
|
|
|
$po = new PricingOptionGroup(PricingOptionKey::OPTION_PRICING_LOGIC); |
|
439
|
|
|
|
|
440
|
|
|
$po->optionDetail = new OptionDetail(); |
|
441
|
|
|
$po->optionDetail->criteriaDetails[] = new CriteriaDetails($pricingLogic); |
|
442
|
|
|
|
|
443
|
|
|
return $po; |
|
444
|
|
|
} |
|
445
|
|
|
|
|
446
|
|
|
/** |
|
447
|
|
|
* @param string $ticketType |
|
448
|
|
|
* @return PricingOptionGroup |
|
449
|
|
|
*/ |
|
450
|
|
View Code Duplication |
protected static function loadTicketType($ticketType) |
|
|
|
|
|
|
451
|
|
|
{ |
|
452
|
|
|
$po = new PricingOptionGroup(PricingOptionKey::OPTION_TICKET_TYPE); |
|
453
|
|
|
|
|
454
|
|
|
$po->optionDetail = new OptionDetail(); |
|
455
|
|
|
$po->optionDetail->criteriaDetails[] = new CriteriaDetails($ticketType); |
|
456
|
|
|
|
|
457
|
|
|
return $po; |
|
458
|
|
|
} |
|
459
|
|
|
|
|
460
|
|
|
/** |
|
461
|
|
|
* @param Tax[] $taxes |
|
462
|
|
|
* @return PricingOptionGroup |
|
463
|
|
|
*/ |
|
464
|
|
|
protected static function loadTaxes($taxes) |
|
465
|
|
|
{ |
|
466
|
|
|
$po = new PricingOptionGroup(PricingOptionKey::OPTION_ADD_TAX); |
|
467
|
|
|
|
|
468
|
|
|
foreach ($taxes as $tax) { |
|
469
|
|
|
$qualifier = (!empty($tax->amount)) ? TaxData::QUALIFIER_AMOUNT : TaxData::QUALIFIER_PERCENTAGE; |
|
470
|
|
|
$rate = (!empty($tax->amount)) ? $tax->amount : $tax->percentage; |
|
471
|
|
|
|
|
472
|
|
|
$po->taxInformation[] = new TaxInformation( |
|
473
|
|
|
$tax->countryCode, |
|
474
|
|
|
$tax->taxNature, |
|
475
|
|
|
$qualifier, |
|
476
|
|
|
$rate |
|
477
|
|
|
); |
|
478
|
|
|
} |
|
479
|
|
|
|
|
480
|
|
|
return $po; |
|
481
|
|
|
} |
|
482
|
|
|
|
|
483
|
|
|
/** |
|
484
|
|
|
* @param ExemptTax[] $exemptTaxes |
|
485
|
|
|
* @return PricingOptionGroup |
|
486
|
|
|
*/ |
|
487
|
|
|
protected static function loadExemptTaxes($exemptTaxes) |
|
488
|
|
|
{ |
|
489
|
|
|
$po = new PricingOptionGroup(PricingOptionKey::OPTION_EXEMPT_FROM_TAX); |
|
490
|
|
|
|
|
491
|
|
|
foreach ($exemptTaxes as $tax) { |
|
492
|
|
|
$po->taxInformation[] = new TaxInformation( |
|
493
|
|
|
$tax->countryCode, |
|
494
|
|
|
$tax->taxNature |
|
495
|
|
|
); |
|
496
|
|
|
} |
|
497
|
|
|
|
|
498
|
|
|
return $po; |
|
499
|
|
|
} |
|
500
|
|
|
|
|
501
|
|
|
/** |
|
502
|
|
|
* @param \DateTime $pastDate |
|
503
|
|
|
* @return PricingOptionGroup |
|
504
|
|
|
*/ |
|
505
|
|
|
protected static function loadPastDate(\DateTime $pastDate) |
|
506
|
|
|
{ |
|
507
|
|
|
$po = new PricingOptionGroup(PricingOptionKey::OPTION_PAST_DATE_PRICING); |
|
508
|
|
|
|
|
509
|
|
|
$po->dateInformation = new DateInformation( |
|
510
|
|
|
DateInformation::OPT_DATE_OVERRIDE, |
|
511
|
|
|
$pastDate |
|
512
|
|
|
); |
|
513
|
|
|
|
|
514
|
|
|
return $po; |
|
515
|
|
|
} |
|
516
|
|
|
|
|
517
|
|
|
/** |
|
518
|
|
|
* @param PaxSegRef[] $references |
|
519
|
|
|
* @return PricingOptionGroup |
|
520
|
|
|
*/ |
|
521
|
|
|
protected static function loadReferences($references) |
|
522
|
|
|
{ |
|
523
|
|
|
$po = new PricingOptionGroup(PricingOptionKey::OPTION_PAX_SEGMENT_TST_SELECTION); |
|
524
|
|
|
|
|
525
|
|
|
$po->paxSegTstReference = new PaxSegTstReference(null, $references); |
|
526
|
|
|
|
|
527
|
|
|
return $po; |
|
528
|
|
|
} |
|
529
|
|
|
|
|
530
|
|
|
/** |
|
531
|
|
|
* Make the correct function code |
|
532
|
|
|
* |
|
533
|
|
|
* @param bool $include |
|
534
|
|
|
* @return string |
|
535
|
|
|
*/ |
|
536
|
|
|
protected static function makeObFeeFunction($include) |
|
537
|
|
|
{ |
|
538
|
|
|
return ($include === true) ? ObFee::FUNCTION_INCLUDE : ObFee::FUNCTION_EXCLUDE; |
|
539
|
|
|
} |
|
540
|
|
|
|
|
541
|
|
|
|
|
542
|
|
|
|
|
543
|
|
|
/** |
|
544
|
|
|
* Avoid double pricing groups when combining an explicitly provided override option with a specific parameter |
|
545
|
|
|
* that uses the same override option. |
|
546
|
|
|
* |
|
547
|
|
|
* Backwards compatibility with PricePnrWithBookingClass12 |
|
548
|
|
|
* |
|
549
|
|
|
* @param string $optionKey |
|
550
|
|
|
* @param PricingOptionGroup[] $priceOptions |
|
551
|
|
|
* @return bool |
|
552
|
|
|
*/ |
|
553
|
|
|
protected static function hasPricingGroup($optionKey, $priceOptions) |
|
554
|
|
|
{ |
|
555
|
|
|
$found = false; |
|
556
|
|
|
|
|
557
|
|
|
foreach ($priceOptions as $pog) { |
|
558
|
|
|
if ($pog->pricingOptionKey->pricingOptionKey === $optionKey) { |
|
559
|
|
|
$found = true; |
|
560
|
|
|
} |
|
561
|
|
|
} |
|
562
|
|
|
|
|
563
|
|
|
return $found; |
|
564
|
|
|
} |
|
565
|
|
|
|
|
566
|
|
|
/** |
|
567
|
|
|
* Merges Pricing options |
|
568
|
|
|
* |
|
569
|
|
|
* @param PricingOptionGroup[] $existingOptions |
|
570
|
|
|
* @param PricingOptionGroup[] $newOptions |
|
571
|
|
|
* @return PricingOptionGroup[] merged array |
|
572
|
|
|
*/ |
|
573
|
|
|
protected static function mergeOptions($existingOptions, $newOptions) |
|
574
|
|
|
{ |
|
575
|
|
|
if (!empty($newOptions)) { |
|
576
|
|
|
$existingOptions = array_merge( |
|
577
|
|
|
$existingOptions, |
|
578
|
|
|
$newOptions |
|
579
|
|
|
); |
|
580
|
|
|
} |
|
581
|
|
|
|
|
582
|
|
|
return $existingOptions; |
|
583
|
|
|
} |
|
584
|
|
|
} |
|
585
|
|
|
|
This property has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.