Completed
Push — master ( 20743e...374ab8 )
by Dieter
05:55
created

Client::offerCreate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
crap 1
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;
24
25
use Amadeus\Client\Base;
26
use Amadeus\Client\Exception;
27
use Amadeus\Client\Params;
28
use Amadeus\Client\RequestOptions;
29
use Amadeus\Client\Result;
30
31
/**
32
 * Amadeus Web Service Client.
33
 *
34
 * TODO:
35
 * - support older versions of SoapHeader (1)
36
 *
37
 * @package Amadeus
38
 * @author Dieter Devlieghere <[email protected]>
39
 */
40
class Client extends Base
41
{
42
    /**
43
     * Amadeus SOAP header version 1
44
     */
45
    const HEADER_V1 = "1";
46
    /**
47
     * Amadeus SOAP header version 2
48
     */
49
    const HEADER_V2 = "2";
50
    /**
51
     * Amadeus SOAP header version 4
52
     */
53
    const HEADER_V4 = "4";
54
55
    /**
56
     * Version string
57
     *
58
     * @var string
59
     */
60
    const VERSION = "1.5.0-dev";
61
62
    /**
63
     * An identifier string for the library (to be used in Received From entries)
64
     *
65
     * @var string
66
     */
67
    const RECEIVED_FROM_IDENTIFIER = "amabnl-amadeus-ws-client";
68
69
    /**
70
     * @var string
71
     */
72
    protected $lastMessage;
73
74
    /**
75
     * Set the session as stateful (true) or stateless (false)
76
     *
77
     * @param bool $newStateful
78
     */
79 1
    public function setStateful($newStateful)
80
    {
81 1
        $this->sessionHandler->setStateful($newStateful);
82 1
    }
83
84
    /**
85
     * @return bool
86
     */
87 3
    public function isStateful()
88
    {
89 3
        return $this->sessionHandler->isStateful();
90
    }
91
92
    /**
93
     * Get the last raw XML message that was sent out
94
     *
95
     * @return string|null
96
     */
97 1
    public function getLastRequest()
98
    {
99 1
        return $this->sessionHandler->getLastRequest($this->lastMessage);
100
    }
101
102
    /**
103
     * Get the last raw XML message that was received
104
     *
105
     * @return string|null
106
     */
107 1
    public function getLastResponse()
108
    {
109 1
        return $this->sessionHandler->getLastResponse($this->lastMessage);
110
    }
111
112
    /**
113
     * Get the request headers for the last SOAP message that was sent out
114
     *
115
     * @return string|null
116
     */
117 1
    public function getLastRequestHeaders()
118
    {
119 1
        return $this->sessionHandler->getLastRequestHeaders($this->lastMessage);
120
    }
121
122
    /**
123
     * Get the response headers for the last SOAP message that was received
124
     *
125
     * @return string|null
126
     */
127 1
    public function getLastResponseHeaders()
128
    {
129 1
        return $this->sessionHandler->getLastResponseHeaders($this->lastMessage);
130
    }
131
132
    /**
133
     * Get session information for authenticated session
134
     *
135
     * - sessionId
136
     * - sequenceNr
137
     * - securityToken
138
     *
139
     * @return array|null
140
     */
141 1
    public function getSessionData()
142
    {
143 1
        return $this->sessionHandler->getSessionData();
144
    }
145
146
    /**
147
     * Restore a previously used session
148
     *
149
     * To be used when implementing your own session pooling system on legacy Soap Header 2 applications.
150
     *
151
     * @param array $sessionData
152
     * @return bool
153
     */
154 1
    public function setSessionData(array $sessionData)
155
    {
156 1
        return $this->sessionHandler->setSessionData($sessionData);
157
    }
158
159
    /**
160
     * Construct Amadeus Web Services client
161
     *
162
     * @param Params $params
163
     */
164 83
    public function __construct(Params $params)
165
    {
166 83
        $this->loadClientParams(
167 83
            $params,
168 83
            self::RECEIVED_FROM_IDENTIFIER,
169
            self::VERSION
170 83
        );
171 82
    }
172
173
    /**
174
     * Authenticate.
175
     *
176
     * Authentication Parameters were provided at construction time (authParams)
177
     *
178
     * @return Result
179
     * @throws Exception
180
     */
181 2
    public function securityAuthenticate()
182
    {
183 2
        $msgName = 'Security_Authenticate';
184
185 2
        return $this->callMessage(
186 2
            $msgName,
187 2
            new RequestOptions\SecurityAuthenticateOptions(
188 2
                $this->authParams
189 2
            ),
190 2
            [],
191
            false
192 2
        );
193
    }
194
195
    /**
196
     * Terminate a session - only applicable to non-stateless mode.
197
     *
198
     * @return Result
199
     * @throws Exception
200
     */
201 1
    public function securitySignOut()
202
    {
203 1
        $msgName = 'Security_SignOut';
204
205 1
        return $this->callMessage(
206 1
            $msgName,
207 1
            new RequestOptions\SecuritySignOutOptions(),
208 1
            [],
209
            true
210 1
        );
211
    }
212
213
    /**
214
     * PNR_Retrieve - Retrieve an Amadeus PNR by record locator
215
     *
216
     * @param RequestOptions\PnrRetrieveOptions $options
217
     * @param array $messageOptions (OPTIONAL)
218
     * @return Result
219
     * @throws Exception
220
     */
221 1
    public function pnrRetrieve(RequestOptions\PnrRetrieveOptions $options, $messageOptions = [])
222
    {
223 1
        $msgName = 'PNR_Retrieve';
224
225 1
        return $this->callMessage($msgName, $options, $messageOptions);
226
    }
227
228
    /**
229
     * Create a PNR using PNR_AddMultiElements
230
     *
231
     * @param RequestOptions\PnrCreatePnrOptions $options
232
     * @param array $messageOptions (OPTIONAL)
233
     * @return Result
234
     */
235 1
    public function pnrCreatePnr(RequestOptions\PnrCreatePnrOptions $options, $messageOptions = [])
236
    {
237 1
        $msgName = 'PNR_AddMultiElements';
238
239 1
        return $this->callMessage($msgName, $options, $messageOptions);
240
    }
241
242
    /**
243
     * PNR_AddMultiElements - Create a new PNR or update an existing PNR.
244
     *
245
     * https://webservices.amadeus.com/extranet/viewService.do?id=25&flavourId=1&menuId=functional
246
     *
247
     * @param RequestOptions\PnrAddMultiElementsOptions $options
248
     * @param array $messageOptions (OPTIONAL)
249
     * @return Result
250
     */
251 2
    public function pnrAddMultiElements(RequestOptions\PnrAddMultiElementsOptions $options, $messageOptions = [])
252
    {
253 2
        $msgName = 'PNR_AddMultiElements';
254
255 2
        return $this->callMessage($msgName, $options, $messageOptions);
256
    }
257
258
    /**
259
     * PNR_RetrieveAndDisplay - Retrieve an Amadeus PNR by record locator including extra info
260
     *
261
     * This extra info is info you cannot see in the regular PNR, like Offers.
262
     *
263
     * https://webservices.amadeus.com/extranet/viewService.do?id=1922&flavourId=1&menuId=functional
264
     *
265
     * @param RequestOptions\PnrRetrieveAndDisplayOptions $options Amadeus Record Locator for PNR
266
     * @param array $messageOptions (OPTIONAL)
267
     * @return Result
268
     * @throws Exception
269
     **/
270 1
    public function pnrRetrieveAndDisplay(RequestOptions\PnrRetrieveAndDisplayOptions $options, $messageOptions = [])
271
    {
272 1
        $msgName = 'PNR_RetrieveAndDisplay';
273
274 1
        return $this->callMessage($msgName, $options, $messageOptions);
275
    }
276
277
    /**
278
     * PNR_Cancel
279
     *
280
     * @param RequestOptions\PnrCancelOptions $options
281
     * @param array $messageOptions (OPTIONAL)
282
     * @return Result
283
     */
284 1
    public function pnrCancel(RequestOptions\PnrCancelOptions $options, $messageOptions = [])
285
    {
286 1
        $msgName = 'PNR_Cancel';
287
288 1
        return $this->callMessage($msgName, $options, $messageOptions);
289
    }
290
291
    /**
292
     * PNR_DisplayHistory
293
     *
294
     * @param RequestOptions\PnrDisplayHistoryOptions $options
295
     * @param array $messageOptions (OPTIONAL)
296
     * @return Result
297
     */
298 1
    public function pnrDisplayHistory(RequestOptions\PnrDisplayHistoryOptions $options, $messageOptions = [])
299
    {
300 1
        $msgName = 'PNR_DisplayHistory';
301
302 1
        return $this->callMessage($msgName, $options, $messageOptions);
303
    }
304
305
    /**
306
     * PNR_TransferOwnership
307
     *
308
     * @param RequestOptions\PnrTransferOwnershipOptions $options
309
     * @param array $messageOptions (OPTIONAL)
310
     * @return Result
311
     */
312 1
    public function pnrTransferOwnership(RequestOptions\PnrTransferOwnershipOptions $options, $messageOptions = [])
313
    {
314 1
        $msgName = 'PNR_TransferOwnership';
315
316 1
        return $this->callMessage($msgName, $options, $messageOptions);
317
    }
318
319
    /**
320
     * PNR_NameChange
321
     *
322
     * @param RequestOptions\PnrNameChangeOptions $options
323
     * @param array $messageOptions (OPTIONAL)
324
     * @return Result
325
     */
326 1
    public function pnrNameChange(RequestOptions\PnrNameChangeOptions $options, $messageOptions = [])
327
    {
328 1
        $msgName = 'PNR_NameChange';
329
330 1
        return $this->callMessage($msgName, $options, $messageOptions);
331
    }
332
333
    /**
334
     * Queue_List - get a list of all PNR's on a given queue
335
     *
336
     * https://webservices.amadeus.com/extranet/viewService.do?id=52&flavourId=1&menuId=functional
337
     *
338
     * @param RequestOptions\QueueListOptions $options
339
     * @param array $messageOptions (OPTIONAL)
340
     * @return Result
341
     */
342 1
    public function queueList(RequestOptions\QueueListOptions $options, $messageOptions = [])
343
    {
344 1
        $msgName = 'Queue_List';
345
346 1
        return $this->callMessage($msgName, $options, $messageOptions);
347
    }
348
349
    /**
350
     * Queue_PlacePNR - Place a PNR on a given queue
351
     *
352
     * @param RequestOptions\QueuePlacePnrOptions $options
353
     * @param array $messageOptions (OPTIONAL)
354
     * @return Result
355
     */
356 1
    public function queuePlacePnr(RequestOptions\QueuePlacePnrOptions $options, $messageOptions = [])
357
    {
358 1
        $msgName = 'Queue_PlacePNR';
359
360 1
        return $this->callMessage($msgName, $options, $messageOptions);
361
    }
362
363
    /**
364
     * Queue_RemoveItem - remove an item (a PNR) from a given queue
365
     *
366
     * @param RequestOptions\QueueRemoveItemOptions $options
367
     * @param array $messageOptions (OPTIONAL)
368
     * @return Result
369
     */
370 1
    public function queueRemoveItem(RequestOptions\QueueRemoveItemOptions $options, $messageOptions = [])
371
    {
372 1
        $msgName = 'Queue_RemoveItem';
373
374 1
        return $this->callMessage($msgName, $options, $messageOptions);
375
    }
376
377
    /**
378
     * Queue_MoveItem - move an item (a PNR) from one queue to another.
379
     *
380
     * @param RequestOptions\QueueMoveItemOptions $options
381
     * @param array $messageOptions (OPTIONAL)
382
     * @return Result
383
     */
384 1
    public function queueMoveItem(RequestOptions\QueueMoveItemOptions $options, $messageOptions = [])
385
    {
386 1
        $msgName = 'Queue_MoveItem';
387
388 1
        return $this->callMessage($msgName, $options, $messageOptions);
389
    }
390
391
    /**
392
     * Offer_CreateOffer
393
     *
394
     * @param RequestOptions\OfferCreateOptions $options
395
     * @param array $messageOptions (OPTIONAL)
396
     * @return Result
397
     */
398 1
    public function offerCreate(RequestOptions\OfferCreateOptions $options, $messageOptions = [])
399
    {
400 1
        $msgName = 'Offer_CreateOffer';
401
402 1
        return $this->callMessage($msgName, $options, $messageOptions);
403
    }
404
405
    /**
406
     * Offer_VerifyOffer
407
     *
408
     * To be called in the context of an open PNR
409
     *
410
     * @param RequestOptions\OfferVerifyOptions $options
411
     * @param array $messageOptions (OPTIONAL)
412
     * @return Result
413
     */
414 1
    public function offerVerify(RequestOptions\OfferVerifyOptions $options, $messageOptions = [])
415
    {
416 1
        $msgName = 'Offer_VerifyOffer';
417
418 1
        return $this->callMessage($msgName, $options, $messageOptions);
419
    }
420
421
    /**
422
     * Offer_ConfirmAirOffer
423
     *
424
     * @param RequestOptions\OfferConfirmAirOptions $options
425
     * @param array $messageOptions (OPTIONAL)
426
     * @return Result
427
     */
428 1
    public function offerConfirmAir(RequestOptions\OfferConfirmAirOptions $options, $messageOptions = [])
429
    {
430 1
        $msgName = 'Offer_ConfirmAirOffer';
431
432 1
        return $this->callMessage($msgName, $options, $messageOptions);
433
    }
434
435
    /**
436
     * Offer_ConfirmHotelOffer
437
     *
438
     * @param RequestOptions\OfferConfirmHotelOptions $options
439
     * @param array $messageOptions (OPTIONAL)
440
     * @return Result
441
     */
442 1
    public function offerConfirmHotel(RequestOptions\OfferConfirmHotelOptions $options, $messageOptions = [])
443
    {
444 1
        $msgName = 'Offer_ConfirmHotelOffer';
445
446 1
        return $this->callMessage($msgName, $options, $messageOptions);
447
    }
448
449
    /**
450
     * Offer_ConfirmCarOffer
451
     *
452
     * @param RequestOptions\OfferConfirmCarOptions $options
453
     * @param array $messageOptions (OPTIONAL)
454
     * @return Result
455
     */
456 1
    public function offerConfirmCar(RequestOptions\OfferConfirmCarOptions $options, $messageOptions = [])
457
    {
458 1
        $msgName = 'Offer_ConfirmCarOffer';
459
460 1
        return $this->callMessage($msgName, $options, $messageOptions);
461
    }
462
463
    /**
464
     * Fare_MasterPricerTravelBoardSearch
465
     *
466
     * @param RequestOptions\FareMasterPricerTbSearch $options
467
     * @param array $messageOptions (OPTIONAL)
468
     * @return Result
469
     */
470 1
    public function fareMasterPricerTravelBoardSearch(
471
        RequestOptions\FareMasterPricerTbSearch $options,
472
        $messageOptions = []
473
    ) {
474 1
        $msgName = 'Fare_MasterPricerTravelBoardSearch';
475
476 1
        return $this->callMessage($msgName, $options, $messageOptions);
477
    }
478
479
    /**
480
     * Fare_MasterPricerCalendar
481
     *
482
     * @param RequestOptions\FareMasterPricerCalendarOptions $options
483
     * @param array $messageOptions (OPTIONAL)
484
     * @return Result
485
     */
486 1
    public function fareMasterPricerCalendar(
487
        RequestOptions\FareMasterPricerCalendarOptions $options,
488
        $messageOptions = []
489
    ) {
490 1
        $msgName = 'Fare_MasterPricerCalendar';
491
492 1
        return $this->callMessage($msgName, $options, $messageOptions);
493
    }
494
495
    /**
496
     * Fare_PricePnrWithBookingClass
497
     *
498
     * @param RequestOptions\FarePricePnrWithBookingClassOptions $options
499
     * @param array $messageOptions (OPTIONAL)
500
     * @return Result
501
     */
502 2
    public function farePricePnrWithBookingClass(
503
        RequestOptions\FarePricePnrWithBookingClassOptions $options,
504
        $messageOptions = []
505
    ) {
506 2
        $msgName = 'Fare_PricePNRWithBookingClass';
507
508 2
        return $this->callMessage($msgName, $options, $messageOptions);
509
    }
510
511
    /**
512
     * Fare_PricePnrWithLowerFares
513
     *
514
     * @param RequestOptions\FarePricePnrWithLowerFaresOptions $options
515
     * @param array $messageOptions (OPTIONAL)
516
     * @return Result
517
     */
518 2
    public function farePricePnrWithLowerFares(
519
        RequestOptions\FarePricePnrWithLowerFaresOptions $options,
520
        $messageOptions = []
521
    ) {
522 2
        $msgName = 'Fare_PricePNRWithLowerFares';
523
524 2
        return $this->callMessage($msgName, $options, $messageOptions);
525
    }
526
527
    /**
528
     * Fare_PricePnrWithLowestFare
529
     *
530
     * @param RequestOptions\FarePricePnrWithLowestFareOptions $options
531
     * @param array $messageOptions (OPTIONAL)
532
     * @return Result
533
     */
534 2
    public function farePricePnrWithLowestFare(
535
        RequestOptions\FarePricePnrWithLowestFareOptions $options,
536
        $messageOptions = []
537
    ) {
538 2
        $msgName = 'Fare_PricePNRWithLowestFare';
539
540 2
        return $this->callMessage($msgName, $options, $messageOptions);
541
    }
542
543
    /**
544
     * Fare_InformativePricingWithoutPNR
545
     *
546
     * @param RequestOptions\FareInformativePricingWithoutPnrOptions $options
547
     * @param array $messageOptions (OPTIONAL)
548
     * @return Result
549
     */
550 1
    public function fareInformativePricingWithoutPnr(
551
        RequestOptions\FareInformativePricingWithoutPnrOptions $options,
552
        $messageOptions = []
553
    ) {
554 1
        $msgName = 'Fare_InformativePricingWithoutPNR';
555
556 1
        return $this->callMessage($msgName, $options, $messageOptions);
557
    }
558
559
    /**
560
     * Fare_InformativeBestPricingWithoutPNR
561
     *
562
     * @param RequestOptions\FareInformativeBestPricingWithoutPnrOptions $options
563
     * @param array $messageOptions (OPTIONAL)
564
     * @return Result
565
     */
566 1
    public function fareInformativeBestPricingWithoutPnr(
567
        RequestOptions\FareInformativeBestPricingWithoutPnrOptions $options,
568
        $messageOptions = []
569
    ) {
570 1
        $msgName = 'Fare_InformativeBestPricingWithoutPNR';
571
572 1
        return $this->callMessage($msgName, $options, $messageOptions);
573
    }
574
575
    /**
576
     * Fare_CheckRules
577
     *
578
     * @param RequestOptions\FareCheckRulesOptions $options
579
     * @param array $messageOptions (OPTIONAL)
580
     * @return Result
581
     */
582 1
    public function fareCheckRules(RequestOptions\FareCheckRulesOptions $options, $messageOptions = [])
583
    {
584 1
        $msgName = 'Fare_CheckRules';
585
586 1
        return $this->callMessage($msgName, $options, $messageOptions);
587
    }
588
589
    /**
590
     * Fare_GetFareRules
591
     *
592
     * @param RequestOptions\FareGetFareRulesOptions $options
593
     * @param array $messageOptions (OPTIONAL)
594
     * @return Result
595
     */
596 1
    public function fareGetFareRules(RequestOptions\FareGetFareRulesOptions $options, $messageOptions = [])
597
    {
598 1
        $msgName = 'Fare_GetFareRules';
599
600 1
        return $this->callMessage($msgName, $options, $messageOptions);
601
    }
602
603
    /**
604
     * Fare_ConvertCurrency
605
     *
606
     * @param RequestOptions\FareConvertCurrencyOptions $options
607
     * @param array $messageOptions (OPTIONAL)
608
     * @return Result
609
     */
610 1
    public function fareConvertCurrency(RequestOptions\FareConvertCurrencyOptions $options, $messageOptions = [])
611
    {
612 1
        $msgName = 'Fare_ConvertCurrency';
613
614 1
        return $this->callMessage($msgName, $options, $messageOptions);
615
    }
616
617
    /**
618
     * Air_MultiAvailability
619
     *
620
     * @param RequestOptions\AirMultiAvailabilityOptions $options
621
     * @param array $messageOptions (OPTIONAL)
622
     * @return Result
623
     */
624 1
    public function airMultiAvailability(
625
        RequestOptions\AirMultiAvailabilityOptions $options,
626
        $messageOptions = []
627
    ) {
628 1
        $msgName = 'Air_MultiAvailability';
629
630 1
        return $this->callMessage($msgName, $options, $messageOptions);
631
    }
632
633
    /**
634
     * Air_SellFromRecommendation
635
     *
636
     * @param RequestOptions\AirSellFromRecommendationOptions $options
637
     * @param array $messageOptions (OPTIONAL)
638
     * @return Result
639
     */
640 1
    public function airSellFromRecommendation(
641
        RequestOptions\AirSellFromRecommendationOptions $options,
642
        $messageOptions = []
643
    ) {
644 1
        $msgName = 'Air_SellFromRecommendation';
645
646 1
        return $this->callMessage($msgName, $options, $messageOptions);
647
    }
648
649
    /**
650
     * Air_FlightInfo
651
     *
652
     * @param RequestOptions\AirFlightInfoOptions $options
653
     * @param array $messageOptions (OPTIONAL)
654
     * @return Result
655
     */
656 1
    public function airFlightInfo(RequestOptions\AirFlightInfoOptions $options, $messageOptions = [])
657
    {
658 1
        $msgName = 'Air_FlightInfo';
659
660 1
        return $this->callMessage($msgName, $options, $messageOptions);
661
    }
662
663
    /**
664
     * Air_RetrieveSeatMap
665
     *
666
     * @param RequestOptions\AirRetrieveSeatMapOptions $options
667
     * @param array $messageOptions (OPTIONAL)
668
     * @return Result
669
     */
670 1
    public function airRetrieveSeatMap(RequestOptions\AirRetrieveSeatMapOptions $options, $messageOptions = [])
671
    {
672 1
        $msgName = 'Air_RetrieveSeatMap';
673
674 1
        return $this->callMessage($msgName, $options, $messageOptions);
675
    }
676
677
    /**
678
     * Command_Cryptic
679
     *
680
     * @param RequestOptions\CommandCrypticOptions $options
681
     * @param array $messageOptions (OPTIONAL)
682
     * @return Result
683
     */
684 1
    public function commandCryptic(RequestOptions\CommandCrypticOptions $options, $messageOptions = [])
685
    {
686 1
        $msgName = 'Command_Cryptic';
687
688 1
        return $this->callMessage($msgName, $options, $messageOptions);
689
    }
690
691
    /**
692
     * MiniRule_GetFromPricingRec
693
     *
694
     * @param RequestOptions\MiniRuleGetFromPricingRecOptions $options
695
     * @param array $messageOptions (OPTIONAL)
696
     * @return Result
697
     */
698 1
    public function miniRuleGetFromPricingRec(
699
        RequestOptions\MiniRuleGetFromPricingRecOptions $options,
700
        $messageOptions = []
701
    ) {
702 1
        $msgName = 'MiniRule_GetFromPricingRec';
703
704 1
        return $this->callMessage($msgName, $options, $messageOptions);
705
    }
706
707
    /**
708
     * MiniRule_GetFromPricing
709
     *
710
     * @param RequestOptions\MiniRuleGetFromPricingOptions $options
711
     * @param array $messageOptions (OPTIONAL)
712
     * @return Result
713
     */
714 1
    public function miniRuleGetFromPricing(
715
        RequestOptions\MiniRuleGetFromPricingOptions $options,
716
        $messageOptions = []
717
    ) {
718 1
        $msgName = 'MiniRule_GetFromPricing';
719
720 1
        return $this->callMessage($msgName, $options, $messageOptions);
721
    }
722
723
    /**
724
     * Info_EncodeDecodeCity
725
     *
726
     * @param RequestOptions\InfoEncodeDecodeCityOptions $options
727
     * @param array $messageOptions (OPTIONAL)
728
     * @return Result
729
     */
730 1
    public function infoEncodeDecodeCity(RequestOptions\InfoEncodeDecodeCityOptions $options, $messageOptions = [])
731
    {
732 1
        $msgName = 'Info_EncodeDecodeCity';
733
734 1
        return $this->callMessage($msgName, $options, $messageOptions);
735
    }
736
737
    /**
738
     * PointOfRef_Search
739
     *
740
     * @param RequestOptions\PointOfRefSearchOptions $options
741
     * @param array $messageOptions (OPTIONAL)
742
     * @return Result
743
     */
744 1
    public function pointOfRefSearch(RequestOptions\PointOfRefSearchOptions $options, $messageOptions = [])
745
    {
746 1
        $msgName = 'PointOfRef_Search';
747
748 1
        return $this->callMessage($msgName, $options, $messageOptions);
749
    }
750
751
752
    /**
753
     * Ticket_CreateTSTFromPricing
754
     *
755
     * @param RequestOptions\TicketCreateTstFromPricingOptions $options
756
     * @param array $messageOptions (OPTIONAL)
757
     * @return Result
758
     */
759 1
    public function ticketCreateTSTFromPricing(
760
        RequestOptions\TicketCreateTstFromPricingOptions $options,
761
        $messageOptions = []
762
    ) {
763 1
        $msgName = 'Ticket_CreateTSTFromPricing';
764
765 1
        return $this->callMessage($msgName, $options, $messageOptions);
766
    }
767
768
    /**
769
     * Ticket_CreateTSMFromPricing
770
     *
771
     * @param RequestOptions\TicketCreateTsmFromPricingOptions $options
772
     * @param array $messageOptions (OPTIONAL)
773
     * @return Result
774
     */
775 1
    public function ticketCreateTSMFromPricing(
776
        RequestOptions\TicketCreateTsmFromPricingOptions $options,
777
        $messageOptions = []
778
    ) {
779 1
        $msgName = 'Ticket_CreateTSMFromPricing';
780
781 1
        return $this->callMessage($msgName, $options, $messageOptions);
782
    }
783
784
    /**
785
     * Ticket_CreateTSMFareElement
786
     *
787
     * @param RequestOptions\TicketCreateTsmFareElOptions $options
788
     * @param array $messageOptions (OPTIONAL)
789
     * @return Result
790
     */
791 1
    public function ticketCreateTSMFareElement(
792
        RequestOptions\TicketCreateTsmFareElOptions $options,
793
        $messageOptions = []
794
    ) {
795 1
        $msgName = 'Ticket_CreateTSMFareElement';
796
797 1
        return $this->callMessage($msgName, $options, $messageOptions);
798
    }
799
800
    /**
801
     * Ticket_DeleteTST
802
     *
803
     * @param RequestOptions\TicketDeleteTstOptions $options
804
     * @param array $messageOptions (OPTIONAL)
805
     * @return Result
806
     */
807 1
    public function ticketDeleteTST(RequestOptions\TicketDeleteTstOptions $options, $messageOptions = [])
808
    {
809 1
        $msgName = 'Ticket_DeleteTST';
810
811 1
        return $this->callMessage($msgName, $options, $messageOptions);
812
    }
813
814
    /**
815
     * Ticket_DeleteTSMP
816
     *
817
     * @param RequestOptions\TicketDeleteTsmpOptions $options
818
     * @param array $messageOptions (OPTIONAL)
819
     * @return Result
820
     */
821 1
    public function ticketDeleteTSMP(RequestOptions\TicketDeleteTsmpOptions $options, $messageOptions = [])
822
    {
823 1
        $msgName = 'Ticket_DeleteTSMP';
824
825 1
        return $this->callMessage($msgName, $options, $messageOptions);
826
    }
827
828
    /**
829
     * Ticket_DisplayTST
830
     *
831
     * @param RequestOptions\TicketDisplayTstOptions $options
832
     * @param array $messageOptions (OPTIONAL)
833
     * @return Result
834
     */
835 1
    public function ticketDisplayTST(RequestOptions\TicketDisplayTstOptions $options, $messageOptions = [])
836
    {
837 1
        $msgName = 'Ticket_DisplayTST';
838
839 1
        return $this->callMessage($msgName, $options, $messageOptions);
840
    }
841
842
    /**
843
     * Ticket_DisplayTSMP
844
     *
845
     * @param RequestOptions\TicketDisplayTsmpOptions $options
846
     * @param array $messageOptions (OPTIONAL)
847
     * @return Result
848
     */
849 1
    public function ticketDisplayTSMP(RequestOptions\TicketDisplayTsmpOptions $options, $messageOptions = [])
850
    {
851 1
        $msgName = 'Ticket_DisplayTSMP';
852
853 1
        return $this->callMessage($msgName, $options, $messageOptions);
854
    }
855
856
    /**
857
     * Ticket_DisplayTSMFareElement
858
     *
859
     * @param RequestOptions\TicketDisplayTsmFareElOptions $options
860
     * @param array $messageOptions (OPTIONAL)
861
     * @return Result
862
     */
863 1
    public function ticketDisplayTSMFareElement(
864
        RequestOptions\TicketDisplayTsmFareElOptions $options,
865
        $messageOptions = []
866
    ) {
867 1
        $msgName = 'Ticket_DisplayTSMFareElement';
868
869 1
        return $this->callMessage($msgName, $options, $messageOptions);
870
    }
871
872
    /**
873
     * Ticket_CheckEligibility
874
     *
875
     * @param RequestOptions\TicketCheckEligibilityOptions $options
876
     * @param array $messageOptions (OPTIONAL)
877
     * @return Result
878
     */
879 1
    public function ticketCheckEligibility(
880
        RequestOptions\TicketCheckEligibilityOptions $options,
881
        $messageOptions = []
882
    ) {
883 1
        $msgName = 'Ticket_CheckEligibility';
884
885 1
        return $this->callMessage($msgName, $options, $messageOptions);
886
    }
887
888
    /**
889
     * Ticket_ATCShopperMasterPricerTravelBoardSearch
890
     *
891
     * @param RequestOptions\TicketAtcShopperMpTbSearchOptions $options
892
     * @param array $messageOptions (OPTIONAL)
893
     * @return Result
894
     */
895 1
    public function ticketAtcShopperMasterPricerTravelBoardSearch(
896
        RequestOptions\TicketAtcShopperMpTbSearchOptions $options,
897
        $messageOptions = []
898
    ) {
899 1
        $msgName = 'Ticket_ATCShopperMasterPricerTravelBoardSearch';
900
901 1
        return $this->callMessage($msgName, $options, $messageOptions);
902
    }
903
904
    /**
905
     * Ticket_RepricePNRWithBookingClass
906
     *
907
     * @param RequestOptions\TicketRepricePnrWithBookingClassOptions $options
908
     * @param array $messageOptions (OPTIONAL)
909
     * @return Result
910
     */
911 1
    public function ticketRepricePnrWithBookingClass(
912
        RequestOptions\TicketRepricePnrWithBookingClassOptions $options,
913
        $messageOptions = []
914
    ) {
915 1
        $msgName = 'Ticket_RepricePNRWithBookingClass';
916
917 1
        return $this->callMessage($msgName, $options, $messageOptions);
918
    }
919
920
    /**
921
     * Ticket_ReissueConfirmedPricing
922
     *
923
     * @param RequestOptions\TicketReissueConfirmedPricingOptions $options
924
     * @param array $messageOptions (OPTIONAL)
925
     * @return Result
926
     */
927 1
    public function ticketReissueConfirmedPricing(
928
        RequestOptions\TicketReissueConfirmedPricingOptions $options,
929
        $messageOptions = []
930
    ) {
931 1
        $msgName = 'Ticket_ReissueConfirmedPricing';
932
933 1
        return $this->callMessage($msgName, $options, $messageOptions);
934
    }
935
936
    /**
937
     * DocIssuance_IssueTicket
938
     *
939
     * @param RequestOptions\DocIssuanceIssueTicketOptions $options
940
     * @param array $messageOptions (OPTIONAL)
941
     * @return Result
942
     */
943 1
    public function docIssuanceIssueTicket(
944
        RequestOptions\DocIssuanceIssueTicketOptions $options,
945
        $messageOptions = []
946
    ) {
947 1
        $msgName = 'DocIssuance_IssueTicket';
948
949 1
        return $this->callMessage($msgName, $options, $messageOptions);
950
    }
951
952
    /**
953
     * DocIssuance_IssueMiscellaneousDocuments
954
     *
955
     * @param RequestOptions\DocIssuanceIssueMiscDocOptions $options
956
     * @param array $messageOptions (OPTIONAL)
957
     * @return Result
958
     */
959 1
    public function docIssuanceIssueMiscellaneousDocuments(
960
        RequestOptions\DocIssuanceIssueMiscDocOptions $options,
961
        $messageOptions = []
962
    ) {
963 1
        $msgName = 'DocIssuance_IssueMiscellaneousDocuments';
964
965 1
        return $this->callMessage($msgName, $options, $messageOptions);
966
    }
967
968
    /**
969
     * DocIssuance_IssueCombined
970
     *
971
     * @param RequestOptions\DocIssuanceIssueCombinedOptions $options
972
     * @param array $messageOptions (OPTIONAL)
973
     * @return Result
974
     */
975 2
    public function docIssuanceIssueCombined(
976
        RequestOptions\DocIssuanceIssueCombinedOptions $options,
977
        $messageOptions = []
978
    ) {
979 2
        $msgName = 'DocIssuance_IssueCombined';
980
981 2
        return $this->callMessage($msgName, $options, $messageOptions);
982
    }
983
984
    /**
985
     * DocRefund_InitRefund
986
     *
987
     * @param RequestOptions\DocRefundInitRefundOptions $options
988
     * @param array $messageOptions (OPTIONAL)
989
     * @return Result
990
     */
991 1
    public function docRefundInitRefund(
992
        RequestOptions\DocRefundInitRefundOptions $options,
993
        $messageOptions = []
994
    ) {
995 1
        $msgName = 'DocRefund_InitRefund';
996
997 1
        return $this->callMessage($msgName, $options, $messageOptions);
998
    }
999
1000
    /**
1001
     * DocRefund_UpdateRefund
1002
     *
1003
     * @param RequestOptions\DocRefundUpdateRefundOptions $options
1004
     * @param array $messageOptions (OPTIONAL)
1005
     * @return Result
1006
     */
1007 1
    public function docRefundUpdateRefund(
1008
        RequestOptions\DocRefundUpdateRefundOptions $options,
1009
        $messageOptions = []
1010
    ) {
1011 1
        $msgName = 'DocRefund_UpdateRefund';
1012
1013 1
        return $this->callMessage($msgName, $options, $messageOptions);
1014
    }
1015
1016
    /**
1017
     * DocRefund_ProcessRefund
1018
     *
1019
     * @param RequestOptions\DocRefundProcessRefundOptions $options
1020
     * @param array $messageOptions (OPTIONAL)
1021
     * @return Result
1022
     */
1023 1
    public function docRefundProcessRefund(
1024
        RequestOptions\DocRefundProcessRefundOptions $options,
1025
        $messageOptions = []
1026
    ) {
1027 1
        $msgName = 'DocRefund_ProcessRefund';
1028
1029 1
        return $this->callMessage($msgName, $options, $messageOptions);
1030
    }
1031
1032
1033
    /**
1034
     * FOP_CreateFormOfPayment
1035
     *
1036
     * @param RequestOptions\FopCreateFopOptions $options
1037
     * @param array $messageOptions (OPTIONAL)
1038
     * @return Result
1039
     */
1040 1
    public function fopCreateFormOfPayment(RequestOptions\FopCreateFopOptions $options, $messageOptions = [])
1041
    {
1042 1
        $msgName = 'FOP_CreateFormOfPayment';
1043
1044 1
        return $this->callMessage($msgName, $options, $messageOptions);
1045
    }
1046
1047
1048
    /**
1049
     * FOP_CreateFormOfPayment
1050
     *
1051
     * @param RequestOptions\FopValidateFopOptions $options
1052
     * @param array $messageOptions (OPTIONAL)
1053
     * @return Result
1054
     */
1055 1
    public function fopValidateFOP(RequestOptions\FopValidateFopOptions $options, $messageOptions = [])
1056
    {
1057 1
        $msgName = 'FOP_ValidateFOP';
1058
1059 1
        return $this->callMessage($msgName, $options, $messageOptions);
1060
    }
1061
1062
    /**
1063
     * PriceXplorer_ExtremeSearch
1064
     *
1065
     * @param RequestOptions\PriceXplorerExtremeSearchOptions $options
1066
     * @param array $messageOptions (OPTIONAL)
1067
     * @return Result
1068
     */
1069 1
    public function priceXplorerExtremeSearch(
1070
        RequestOptions\PriceXplorerExtremeSearchOptions $options,
1071
        $messageOptions = []
1072
    ) {
1073 1
        $msgName = 'PriceXplorer_ExtremeSearch';
1074
1075 1
        return $this->callMessage($msgName, $options, $messageOptions);
1076
    }
1077
1078
    /**
1079
     * SalesReports_DisplayQueryReport
1080
     *
1081
     * @param RequestOptions\SalesReportsDisplayQueryReportOptions $options
1082
     * @param array $messageOptions (OPTIONAL)
1083
     * @return Result
1084
     */
1085 1
    public function salesReportsDisplayQueryReport(
1086
        RequestOptions\SalesReportsDisplayQueryReportOptions $options,
1087
        $messageOptions = []
1088
    ) {
1089 1
        $msgName = 'SalesReports_DisplayQueryReport';
1090
1091 1
        return $this->callMessage($msgName, $options, $messageOptions);
1092
    }
1093
1094
    /**
1095
     * Service_IntegratedPricing
1096
     *
1097
     * @param RequestOptions\ServiceIntegratedPricingOptions $options
1098
     * @param array $messageOptions (OPTIONAL)
1099
     * @return Result
1100
     */
1101 1
    public function serviceIntegratedPricing(
1102
        RequestOptions\ServiceIntegratedPricingOptions $options,
1103
        $messageOptions = []
1104
    ) {
1105 1
        $msgName = 'Service_IntegratedPricing';
1106
1107 1
        return $this->callMessage($msgName, $options, $messageOptions);
1108
    }
1109
1110
    /**
1111
     * Service_IntegratedCatalogue
1112
     *
1113
     * @param RequestOptions\ServiceIntegratedCatalogueOptions $options
1114
     * @param array $messageOptions (OPTIONAL)
1115
     * @return Result
1116
     */
1117 1
    public function serviceIntegratedCatalogue(
1118
        RequestOptions\ServiceIntegratedCatalogueOptions $options,
1119
        $messageOptions = []
1120
    ) {
1121 1
        $msgName = 'Service_IntegratedCatalogue';
1122
1123 1
        return $this->callMessage($msgName, $options, $messageOptions);
1124
    }
1125
1126
    /**
1127
     * Call a message with the given parameters
1128
     *
1129
     * @param string $messageName
1130
     * @param RequestOptions\RequestOptionsInterface $options
1131
     * @param array $messageOptions
1132
     * @param bool $endSession
1133
     * @return Result
1134
     * @throws Client\Exception
1135
     * @throws Client\Struct\InvalidArgumentException
1136
     * @throws Client\InvalidMessageException
1137
     * @throws Client\RequestCreator\MessageVersionUnsupportedException
1138
     * @throws \RuntimeException
1139
     * @throws \InvalidArgumentException
1140
     */
1141 68
    protected function callMessage($messageName, $options, $messageOptions, $endSession = false)
1142
    {
1143 68
        $messageOptions = $this->makeMessageOptions($messageOptions, $endSession);
1144
1145 68
        $this->lastMessage = $messageName;
1146
1147 68
        $sendResult = $this->sessionHandler->sendMessage(
1148 68
            $messageName,
1149 68
            $this->requestCreator->createRequest(
1150 68
                $messageName,
1151
                $options
1152 68
            ),
1153
            $messageOptions
1154 68
        );
1155
1156 68
        $response = $this->responseHandler->analyzeResponse(
1157 68
            $sendResult,
1158
            $messageName
1159 68
        );
1160
1161 68
        if ($messageOptions['returnXml'] === false) {
1162 1
            $response->responseXml = null;
1163 1
        }
1164
1165 68
        return $response;
1166
    }
1167
1168
    /**
1169
     * Make message options
1170
     *
1171
     * Message options are meta options when sending a message to the amadeus web services
1172
     * - 'endSession' (if stateful) : should we end the current session after sending this call?
1173
     * - 'returnXml' : Should we return the XML string in the Result::responseXml property?
1174
     *   (this overrides the default setting returnXml in the Amadeus\Client\Params for a single message)
1175
     *
1176
     * @param array $incoming The Message options chosen by the caller - if any.
1177
     * @param bool $endSession Switch if you want to terminate the current session after making the call.
1178
     * @return array
1179
     */
1180 74
    protected function makeMessageOptions(array $incoming, $endSession = false)
1181
    {
1182
        $options = [
1183 74
            'endSession' => $endSession,
1184 74
            'returnXml' => $this->returnResultXml
1185 74
        ];
1186
1187 74
        if (array_key_exists('endSession', $incoming)) {
1188 1
            $options['endSession'] = $incoming['endSession'];
1189 1
        }
1190
1191 74
        if (array_key_exists('returnXml', $incoming)) {
1192 3
            $options['returnXml'] = $incoming['returnXml'];
1193 3
        }
1194
1195 74
        return $options;
1196
    }
1197
}
1198